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

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

Issue 9826023: Merge AudioRendererImpl and AudioRendererBase; add NullAudioSink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win build Created 8 years, 8 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_base_unittest.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
7
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
10 // decoding to /dev/null!
11 //
12 // NullAudioRenderer 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
14 // platform yet.
15
16 #include <deque>
17
18 #include "base/memory/scoped_ptr.h"
19 #include "base/threading/thread.h"
20 #include "media/base/buffers.h"
21 #include "media/base/filters.h"
22 #include "media/filters/audio_renderer_base.h"
23
24 namespace media {
25
26 class MEDIA_EXPORT NullAudioRenderer : public AudioRendererBase {
27 public:
28 NullAudioRenderer();
29 virtual ~NullAudioRenderer();
30
31 // AudioRenderer implementation.
32 virtual void SetVolume(float volume) OVERRIDE;
33
34 protected:
35 // AudioRendererBase implementation.
36 virtual bool OnInitialize(int bits_per_channel,
37 ChannelLayout channel_layout,
38 int sample_rate) OVERRIDE;
39 virtual void OnStop() OVERRIDE;
40 virtual void OnRenderEndOfStream() OVERRIDE;
41
42 private:
43 // Audio thread task that periodically calls FillBuffer() to consume
44 // audio data.
45 void FillBufferTask();
46
47 // A number to convert bytes written in FillBuffer to milliseconds based on
48 // the audio format.
49 size_t bytes_per_millisecond_;
50
51 // A buffer passed to FillBuffer to advance playback.
52 scoped_array<uint8> buffer_;
53 size_t buffer_size_;
54
55 size_t bytes_per_frame_;
56
57 // Separate thread used to throw away data.
58 base::Thread thread_;
59
60 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer);
61 };
62
63 } // namespace media
64
65 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_base_unittest.cc ('k') | media/filters/null_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698