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

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

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gotta catch'em all! Created 8 years, 4 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
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>
17
18 #include "base/md5.h" 16 #include "base/md5.h"
17 #include "base/memory/scoped_ptr.h"
19 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
20 #include "media/base/audio_renderer_sink.h" 19 #include "media/base/audio_renderer_sink.h"
21 20
22 namespace media { 21 namespace media {
22 class AudioBus;
23 23
24 class MEDIA_EXPORT NullAudioSink 24 class MEDIA_EXPORT NullAudioSink
25 : NON_EXPORTED_BASE(public AudioRendererSink) { 25 : NON_EXPORTED_BASE(public AudioRendererSink) {
26 public: 26 public:
27 NullAudioSink(); 27 NullAudioSink();
28 28
29 // AudioRendererSink implementation. 29 // AudioRendererSink implementation.
30 virtual void Initialize(const AudioParameters& params, 30 virtual void Initialize(const AudioParameters& params,
31 RenderCallback* callback) OVERRIDE; 31 RenderCallback* callback) OVERRIDE;
32 virtual void Start() OVERRIDE; 32 virtual void Start() OVERRIDE;
(...skipping 13 matching lines...) Expand all
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); 53 void SetPlaying(bool is_playing);
54 54
55 // A buffer passed to FillBuffer to advance playback. 55 // A buffer passed to FillBuffer to advance playback.
56 std::vector<float*> audio_data_; 56 scoped_ptr<AudioBus> audio_bus_;
57 57
58 AudioParameters params_; 58 AudioParameters params_;
59 bool initialized_; 59 bool initialized_;
60 bool playing_; 60 bool playing_;
61 RenderCallback* callback_; 61 RenderCallback* callback_;
62 62
63 // Separate thread used to throw away data. 63 // Separate thread used to throw away data.
64 base::Thread thread_; 64 base::Thread thread_;
65 base::Lock lock_; 65 base::Lock lock_;
66 66
67 // Controls whether or not a running MD5 hash is computed for audio frames. 67 // Controls whether or not a running MD5 hash is computed for audio frames.
68 bool hash_audio_for_testing_; 68 bool hash_audio_for_testing_;
69 scoped_array<base::MD5Context> md5_channel_contexts_; 69 scoped_array<base::MD5Context> md5_channel_contexts_;
70 70
71 DISALLOW_COPY_AND_ASSIGN(NullAudioSink); 71 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
72 }; 72 };
73 73
74 } // namespace media 74 } // namespace media
75 75
76 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 76 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698