Files.app: Provide detailed change information on onDirectoryChanged event
[chromium-blink-merge.git] / media / audio / null_audio_sink.h
blobc28a2cfac06f8af39d507b077feede0ec630f292
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_AUDIO_NULL_AUDIO_SINK_H_
6 #define MEDIA_AUDIO_NULL_AUDIO_SINK_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "media/base/audio_renderer_sink.h"
13 namespace base {
14 class SingleThreadTaskRunner;
17 namespace media {
18 class AudioBus;
19 class AudioHash;
20 class FakeAudioConsumer;
22 class MEDIA_EXPORT NullAudioSink
23 : NON_EXPORTED_BASE(public AudioRendererSink) {
24 public:
25 NullAudioSink(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
27 // AudioRendererSink implementation.
28 virtual void Initialize(const AudioParameters& params,
29 RenderCallback* callback) OVERRIDE;
30 virtual void Start() OVERRIDE;
31 virtual void Stop() OVERRIDE;
32 virtual void Pause() OVERRIDE;
33 virtual void Play() OVERRIDE;
34 virtual bool SetVolume(double volume) OVERRIDE;
36 // Enables audio frame hashing. Must be called prior to Initialize().
37 void StartAudioHashForTesting();
39 // Returns the hash of all audio frames seen since construction.
40 std::string GetAudioHashForTesting();
42 protected:
43 virtual ~NullAudioSink();
45 private:
46 // Task that periodically calls Render() to consume audio data.
47 void CallRender(AudioBus* audio_bus);
49 bool initialized_;
50 bool playing_;
51 RenderCallback* callback_;
53 // Controls whether or not a running hash is computed for audio frames.
54 scoped_ptr<AudioHash> audio_hash_;
56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
57 scoped_ptr<FakeAudioConsumer> fake_consumer_;
59 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
62 } // namespace media
64 #endif // MEDIA_AUDIO_NULL_AUDIO_SINK_H_