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_
10 #include "base/memory/scoped_ptr.h"
11 #include "media/base/audio_renderer_sink.h"
14 class SingleThreadTaskRunner
;
20 class FakeAudioWorker
;
23 class MEDIA_EXPORT NullAudioSink
24 : NON_EXPORTED_BASE(public AudioRendererSink
) {
26 NullAudioSink(const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
);
28 // AudioRendererSink implementation.
29 void Initialize(const AudioParameters
& params
,
30 RenderCallback
* callback
) override
;
31 void Start() override
;
33 void Pause() override
;
35 bool SetVolume(double volume
) override
;
36 OutputDevice
* GetOutputDevice() override
;
38 // Enables audio frame hashing. Must be called prior to Initialize().
39 void StartAudioHashForTesting();
41 // Returns the hash of all audio frames seen since construction.
42 std::string
GetAudioHashForTesting();
45 ~NullAudioSink() override
;
48 // Task that periodically calls Render() to consume audio data.
53 RenderCallback
* callback_
;
55 // Controls whether or not a running hash is computed for audio frames.
56 scoped_ptr
<AudioHash
> audio_hash_
;
58 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
59 scoped_ptr
<FakeAudioWorker
> fake_worker_
;
60 scoped_ptr
<AudioBus
> audio_bus_
;
62 DISALLOW_COPY_AND_ASSIGN(NullAudioSink
);
67 #endif // MEDIA_AUDIO_NULL_AUDIO_SINK_H_