OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // NullAudioRenderer effectively uses an extra thread to "throw away" the | 8 // NullAudioRenderer 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! |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace media { | 24 namespace media { |
25 | 25 |
26 class MEDIA_EXPORT NullAudioRenderer | 26 class MEDIA_EXPORT NullAudioRenderer |
27 : public AudioRendererBase, | 27 : public AudioRendererBase, |
28 public base::PlatformThread::Delegate { | 28 public base::PlatformThread::Delegate { |
29 public: | 29 public: |
30 NullAudioRenderer(); | 30 NullAudioRenderer(); |
31 virtual ~NullAudioRenderer(); | 31 virtual ~NullAudioRenderer(); |
32 | 32 |
33 // AudioRenderer implementation. | 33 // AudioRenderer implementation. |
34 virtual void SetVolume(float volume); | 34 virtual void SetVolume(float volume) OVERRIDE; |
35 | 35 |
36 // PlatformThread::Delegate implementation. | 36 // PlatformThread::Delegate implementation. |
37 virtual void ThreadMain(); | 37 virtual void ThreadMain() OVERRIDE; |
38 | 38 |
39 protected: | 39 protected: |
40 // AudioRendererBase implementation. | 40 // AudioRendererBase implementation. |
41 virtual bool OnInitialize(int bits_per_channel, | 41 virtual bool OnInitialize(int bits_per_channel, |
42 ChannelLayout channel_layout, | 42 ChannelLayout channel_layout, |
43 int sample_rate); | 43 int sample_rate) OVERRIDE; |
44 virtual void OnStop(); | 44 virtual void OnStop() OVERRIDE; |
45 | 45 |
46 private: | 46 private: |
47 // A number to convert bytes written in FillBuffer to milliseconds based on | 47 // A number to convert bytes written in FillBuffer to milliseconds based on |
48 // the audio format. | 48 // the audio format. |
49 size_t bytes_per_millisecond_; | 49 size_t bytes_per_millisecond_; |
50 | 50 |
51 // A buffer passed to FillBuffer to advance playback. | 51 // A buffer passed to FillBuffer to advance playback. |
52 scoped_array<uint8> buffer_; | 52 scoped_array<uint8> buffer_; |
53 size_t buffer_size_; | 53 size_t buffer_size_; |
54 | 54 |
55 // Separate thread used to throw away data. | 55 // Separate thread used to throw away data. |
56 base::PlatformThreadHandle thread_; | 56 base::PlatformThreadHandle thread_; |
57 | 57 |
58 // Shutdown flag. | 58 // Shutdown flag. |
59 bool shutdown_; | 59 bool shutdown_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer); | 61 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace media | 64 } // namespace media |
65 | 65 |
66 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ | 66 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ |
OLD | NEW |