OLD | NEW |
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! |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 std::string GetAudioHashForTesting(); | 43 std::string GetAudioHashForTesting(); |
44 | 44 |
45 protected: | 45 protected: |
46 virtual ~NullAudioSink(); | 46 virtual ~NullAudioSink(); |
47 | 47 |
48 private: | 48 private: |
49 // Audio thread task that periodically calls FillBuffer() to consume | 49 // Audio thread task that periodically calls FillBuffer() to consume |
50 // audio data. | 50 // audio data. |
51 void FillBufferTask(); | 51 void FillBufferTask(); |
52 | 52 |
53 void SetPlaying(bool is_playing); | |
54 | |
55 // A buffer passed to FillBuffer to advance playback. | 53 // A buffer passed to FillBuffer to advance playback. |
56 scoped_ptr<AudioBus> audio_bus_; | 54 scoped_ptr<AudioBus> audio_bus_; |
57 | 55 |
58 AudioParameters params_; | 56 AudioParameters params_; |
59 bool initialized_; | 57 bool initialized_; |
60 bool playing_; | 58 bool playing_; |
61 RenderCallback* callback_; | 59 RenderCallback* callback_; |
62 | 60 |
63 // Separate thread used to throw away data. | 61 // Separate thread used to throw away data. |
64 base::Thread thread_; | 62 base::Thread thread_; |
65 base::Lock lock_; | |
66 | 63 |
67 // Controls whether or not a running MD5 hash is computed for audio frames. | 64 // Controls whether or not a running MD5 hash is computed for audio frames. |
68 bool hash_audio_for_testing_; | 65 bool hash_audio_for_testing_; |
69 scoped_array<base::MD5Context> md5_channel_contexts_; | 66 scoped_array<base::MD5Context> md5_channel_contexts_; |
70 | 67 |
71 DISALLOW_COPY_AND_ASSIGN(NullAudioSink); | 68 DISALLOW_COPY_AND_ASSIGN(NullAudioSink); |
72 }; | 69 }; |
73 | 70 |
74 } // namespace media | 71 } // namespace media |
75 | 72 |
76 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ | 73 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ |
OLD | NEW |