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

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

Issue 10067035: RefCounted types should not have public destructors, media/ and gpu/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 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_output_dispatcher.h ('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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 5 #ifndef MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
7 7
8 // NullAudioSink effectively uses an extra thread to "throw away" the 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 9 // audio data at a rate resembling normal playback speed. It's just like
10 // decoding to /dev/null! 10 // decoding to /dev/null!
11 // 11 //
12 // NullAudioSink can also be used in situations where the client has no 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 13 // audio device or we haven't written an audio implementation for a particular
14 // platform yet. 14 // platform yet.
15 15
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "media/base/audio_renderer_sink.h" 19 #include "media/base/audio_renderer_sink.h"
20 20
21 namespace media { 21 namespace media {
22 22
23 class MEDIA_EXPORT NullAudioSink 23 class MEDIA_EXPORT NullAudioSink
24 : NON_EXPORTED_BASE(public AudioRendererSink) { 24 : NON_EXPORTED_BASE(public AudioRendererSink) {
25 public: 25 public:
26 NullAudioSink(); 26 NullAudioSink();
27 virtual ~NullAudioSink();
28 27
29 // AudioRendererSink implementation. 28 // AudioRendererSink implementation.
30 virtual void Initialize(const AudioParameters& params, 29 virtual void Initialize(const AudioParameters& params,
31 RenderCallback* callback) OVERRIDE; 30 RenderCallback* callback) OVERRIDE;
32 virtual void Start() OVERRIDE; 31 virtual void Start() OVERRIDE;
33 virtual void Stop() OVERRIDE; 32 virtual void Stop() OVERRIDE;
34 virtual void Pause(bool flush) OVERRIDE; 33 virtual void Pause(bool flush) OVERRIDE;
35 virtual void Play() OVERRIDE; 34 virtual void Play() OVERRIDE;
36 virtual void SetPlaybackRate(float rate) OVERRIDE; 35 virtual void SetPlaybackRate(float rate) OVERRIDE;
37 virtual bool SetVolume(double volume) OVERRIDE; 36 virtual bool SetVolume(double volume) OVERRIDE;
38 virtual void GetVolume(double* volume) OVERRIDE; 37 virtual void GetVolume(double* volume) OVERRIDE;
39 38
39 protected:
40 virtual ~NullAudioSink();
41
40 private: 42 private:
41 // Audio thread task that periodically calls FillBuffer() to consume 43 // Audio thread task that periodically calls FillBuffer() to consume
42 // audio data. 44 // audio data.
43 void FillBufferTask(); 45 void FillBufferTask();
44 46
45 void SetPlaying(bool is_playing); 47 void SetPlaying(bool is_playing);
46 48
47 // A buffer passed to FillBuffer to advance playback. 49 // A buffer passed to FillBuffer to advance playback.
48 std::vector<float*> audio_data_; 50 std::vector<float*> audio_data_;
49 51
50 AudioParameters params_; 52 AudioParameters params_;
51 bool initialized_; 53 bool initialized_;
52 float playback_rate_; 54 float playback_rate_;
53 bool playing_; 55 bool playing_;
54 RenderCallback* callback_; 56 RenderCallback* callback_;
55 57
56 // Separate thread used to throw away data. 58 // Separate thread used to throw away data.
57 base::Thread thread_; 59 base::Thread thread_;
58 base::Lock lock_; 60 base::Lock lock_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(NullAudioSink); 62 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
61 }; 63 };
62 64
63 } // namespace media 65 } // namespace media
64 66
65 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 67 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_dispatcher.h ('k') | media/audio/null_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698