Disable webrtc.webrtc_cases.
[chromium-blink-merge.git] / media / audio / null_audio_sink.h
blobd8d5f0401ee1b851e189453ffeaf7dd6456daba1
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 FakeAudioWorker;
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 void Initialize(const AudioParameters& params,
29 RenderCallback* callback) override;
30 void Start() override;
31 void Stop() override;
32 void Pause() override;
33 void Play() override;
34 bool SetVolume(double volume) override;
35 void SwitchOutputDevice(const std::string& device_id,
36 const GURL& security_origin,
37 const SwitchOutputDeviceCB& callback) override;
39 // Enables audio frame hashing. Must be called prior to Initialize().
40 void StartAudioHashForTesting();
42 // Returns the hash of all audio frames seen since construction.
43 std::string GetAudioHashForTesting();
45 protected:
46 ~NullAudioSink() override;
48 private:
49 // Task that periodically calls Render() to consume audio data.
50 void CallRender();
52 bool initialized_;
53 bool playing_;
54 RenderCallback* callback_;
56 // Controls whether or not a running hash is computed for audio frames.
57 scoped_ptr<AudioHash> audio_hash_;
59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
60 scoped_ptr<FakeAudioWorker> fake_worker_;
61 scoped_ptr<AudioBus> audio_bus_;
63 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
66 } // namespace media
68 #endif // MEDIA_AUDIO_NULL_AUDIO_SINK_H_