Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: media/audio/null_audio_sink.h

Issue 9826023: Merge AudioRendererImpl and AudioRendererBase; add NullAudioSink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win build Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_util.cc ('k') | media/audio/null_audio_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
7
8 // NullAudioSink effectively uses an extra thread to "throw away" the
9 // audio data at a rate resembling normal playback speed. It's just like
10 // decoding to /dev/null!
11 //
12 // NullAudioSink can also be used in situations where the client has no
13 // audio device or we haven't written an audio implementation for a particular
14 // platform yet.
15
16 #include <vector>
17
18 #include "base/threading/thread.h"
19 #include "media/base/audio_renderer_sink.h"
20
21 namespace media {
22
23 class MEDIA_EXPORT NullAudioSink
24 : NON_EXPORTED_BASE(public AudioRendererSink) {
25 public:
26 NullAudioSink();
27 virtual ~NullAudioSink();
28
29 // AudioRendererSink implementation.
30 virtual void Initialize(const AudioParameters& params,
31 RenderCallback* callback) OVERRIDE;
32 virtual void Start() OVERRIDE;
33 virtual void Stop() OVERRIDE;
34 virtual void Pause(bool flush) OVERRIDE;
35 virtual void Play() OVERRIDE;
36 virtual void SetPlaybackRate(float rate) OVERRIDE;
37 virtual bool SetVolume(double volume) OVERRIDE;
38 virtual void GetVolume(double* volume) OVERRIDE;
39
40 private:
41 // Audio thread task that periodically calls FillBuffer() to consume
42 // audio data.
43 void FillBufferTask();
44
45 void SetPlaying(bool is_playing);
46
47 // A buffer passed to FillBuffer to advance playback.
48 std::vector<float*> audio_data_;
49
50 AudioParameters params_;
51 bool initialized_;
52 float playback_rate_;
53 bool playing_;
54 RenderCallback* callback_;
55
56 // Separate thread used to throw away data.
57 base::Thread thread_;
58 base::Lock lock_;
59
60 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
61 };
62
63 } // namespace media
64
65 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_util.cc ('k') | media/audio/null_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698