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

Side by Side Diff: media/filters/null_audio_renderer.h

Issue 155695: Replace the guts of AudioRendererBase with calls to scaling algorithm. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « media/filters/audio_renderer_impl.cc ('k') | media/filters/null_audio_renderer.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 21 matching lines...) Expand all
32 class NullAudioRenderer : public AudioRendererBase, PlatformThread::Delegate { 32 class NullAudioRenderer : public AudioRendererBase, PlatformThread::Delegate {
33 public: 33 public:
34 // FilterFactory provider. 34 // FilterFactory provider.
35 static FilterFactory* CreateFilterFactory() { 35 static FilterFactory* CreateFilterFactory() {
36 return new FilterFactoryImpl0<NullAudioRenderer>(); 36 return new FilterFactoryImpl0<NullAudioRenderer>();
37 } 37 }
38 38
39 // Compatible with any audio/x-uncompressed MediaFormat. 39 // Compatible with any audio/x-uncompressed MediaFormat.
40 static bool IsMediaFormatSupported(const MediaFormat& media_format); 40 static bool IsMediaFormatSupported(const MediaFormat& media_format);
41 41
42 // MediaFilter implementation.
43 virtual void SetPlaybackRate(float playback_rate);
44
45 // AudioRenderer implementation. 42 // AudioRenderer implementation.
46 virtual void SetVolume(float volume); 43 virtual void SetVolume(float volume);
47 44
48 // PlatformThread::Delegate implementation. 45 // PlatformThread::Delegate implementation.
49 virtual void ThreadMain(); 46 virtual void ThreadMain();
50 47
51 protected: 48 protected:
52 // Only allow a factory to create this class. 49 // Only allow a factory to create this class.
53 friend class FilterFactoryImpl0<NullAudioRenderer>; 50 friend class FilterFactoryImpl0<NullAudioRenderer>;
54 NullAudioRenderer(); 51 NullAudioRenderer();
55 virtual ~NullAudioRenderer(); 52 virtual ~NullAudioRenderer();
56 53
57 // AudioRendererBase implementation. 54 // AudioRendererBase implementation.
58 virtual bool OnInitialize(const MediaFormat& media_format); 55 virtual bool OnInitialize(const MediaFormat& media_format);
59 virtual void OnStop(); 56 virtual void OnStop();
60 57
61 private: 58 private:
62 // Current playback rate.
63 float playback_rate_;
64
65 // A number to convert bytes written in FillBuffer to milliseconds based on 59 // A number to convert bytes written in FillBuffer to milliseconds based on
66 // the audio format. Calculated in OnInitialize by looking at the decoder's 60 // the audio format. Calculated in OnInitialize by looking at the decoder's
67 // MediaFormat. 61 // MediaFormat.
68 size_t bytes_per_millisecond_; 62 size_t bytes_per_millisecond_;
69 63
70 // A buffer passed to FillBuffer to advance playback. 64 // A buffer passed to FillBuffer to advance playback.
71 scoped_ptr<uint8> buffer_; 65 scoped_ptr<uint8> buffer_;
72 size_t buffer_size_; 66 size_t buffer_size_;
73 67
74 // Separate thread used to throw away data. 68 // Separate thread used to throw away data.
75 PlatformThreadHandle thread_; 69 PlatformThreadHandle thread_;
76 70
77 // Shutdown flag. 71 // Shutdown flag.
78 bool shutdown_; 72 bool shutdown_;
79 73
80 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer); 74 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer);
81 }; 75 };
82 76
83 } // namespace media 77 } // namespace media
84 78
85 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 79 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_impl.cc ('k') | media/filters/null_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698