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

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

Issue 10837032: Fix playback rate w/o audio. Remove unused SetPlaybackRate(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « content/renderer/media/render_audiosourceprovider.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
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 15 matching lines...) Expand all
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;
33 virtual void Stop() OVERRIDE; 33 virtual void Stop() OVERRIDE;
34 virtual void Pause(bool flush) OVERRIDE; 34 virtual void Pause(bool flush) OVERRIDE;
35 virtual void Play() OVERRIDE; 35 virtual void Play() OVERRIDE;
36 virtual void SetPlaybackRate(float rate) OVERRIDE;
37 virtual bool SetVolume(double volume) OVERRIDE; 36 virtual bool SetVolume(double volume) OVERRIDE;
38 37
39 // Enables audio frame hashing and reinitializes the MD5 context. Must be 38 // Enables audio frame hashing and reinitializes the MD5 context. Must be
40 // called prior to Initialize(). 39 // called prior to Initialize().
41 void StartAudioHashForTesting(); 40 void StartAudioHashForTesting();
42 41
43 // Returns the MD5 hash of all audio frames seen since the last reset. 42 // Returns the MD5 hash of all audio frames seen since the last reset.
44 std::string GetAudioHashForTesting(); 43 std::string GetAudioHashForTesting();
45 44
46 protected: 45 protected:
47 virtual ~NullAudioSink(); 46 virtual ~NullAudioSink();
48 47
49 private: 48 private:
50 // Audio thread task that periodically calls FillBuffer() to consume 49 // Audio thread task that periodically calls FillBuffer() to consume
51 // audio data. 50 // audio data.
52 void FillBufferTask(); 51 void FillBufferTask();
53 52
54 void SetPlaying(bool is_playing); 53 void SetPlaying(bool is_playing);
55 54
56 // A buffer passed to FillBuffer to advance playback. 55 // A buffer passed to FillBuffer to advance playback.
57 std::vector<float*> audio_data_; 56 std::vector<float*> audio_data_;
58 57
59 AudioParameters params_; 58 AudioParameters params_;
60 bool initialized_; 59 bool initialized_;
61 float playback_rate_;
62 bool playing_; 60 bool playing_;
63 RenderCallback* callback_; 61 RenderCallback* callback_;
64 62
65 // Separate thread used to throw away data. 63 // Separate thread used to throw away data.
66 base::Thread thread_; 64 base::Thread thread_;
67 base::Lock lock_; 65 base::Lock lock_;
68 66
69 // 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.
70 bool hash_audio_for_testing_; 68 bool hash_audio_for_testing_;
71 scoped_array<base::MD5Context> md5_channel_contexts_; 69 scoped_array<base::MD5Context> md5_channel_contexts_;
72 70
73 DISALLOW_COPY_AND_ASSIGN(NullAudioSink); 71 DISALLOW_COPY_AND_ASSIGN(NullAudioSink);
74 }; 72 };
75 73
76 } // namespace media 74 } // namespace media
77 75
78 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 76 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/render_audiosourceprovider.cc ('k') | media/audio/null_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698