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

Side by Side Diff: media/base/audio_renderer_sink.h

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup MCR AudioBus usage. 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 | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_render_callback.h » ('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_BASE_AUDIO_RENDERER_SINK_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "media/audio/audio_parameters.h" 11 #include "media/audio/audio_parameters.h"
12 #include "media/base/audio_bus.h"
12 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 // AudioRendererSink is an interface representing the end-point for 17 // AudioRendererSink is an interface representing the end-point for
17 // rendered audio. An implementation is expected to 18 // rendered audio. An implementation is expected to
18 // periodically call Render() on a callback object. 19 // periodically call Render() on a callback object.
19 20
20 class AudioRendererSink 21 class AudioRendererSink
21 : public base::RefCountedThreadSafe<media::AudioRendererSink> { 22 : public base::RefCountedThreadSafe<media::AudioRendererSink> {
22 public: 23 public:
23 class RenderCallback { 24 class RenderCallback {
24 public: 25 public:
25 // Fills entire buffer of length |number_of_frames| but returns actual 26 // Attempts to completely fill all channels of |audio_bus|, returns actual
26 // number of frames it got from its source (|number_of_frames| in case of 27 // number of frames filled.
27 // continuous stream). That actual number of frames is passed to host 28 virtual int Render(AudioBus* audio_bus, int audio_delay_milliseconds) = 0;
28 // together with PCM audio data and host is free to use or ignore it.
29 // TODO(crogers): use base:Callback instead.
30 virtual int Render(const std::vector<float*>& audio_data,
31 int number_of_frames,
32 int audio_delay_milliseconds) = 0;
33 29
34 // Signals an error has occurred. 30 // Signals an error has occurred.
35 virtual void OnRenderError() = 0; 31 virtual void OnRenderError() = 0;
36 32
37 protected: 33 protected:
38 virtual ~RenderCallback() {} 34 virtual ~RenderCallback() {}
39 }; 35 };
40 36
41 // Sets important information about the audio stream format. 37 // Sets important information about the audio stream format.
42 // It must be called before any of the other methods. 38 // It must be called before any of the other methods.
(...skipping 17 matching lines...) Expand all
60 virtual bool SetVolume(double volume) = 0; 56 virtual bool SetVolume(double volume) = 0;
61 57
62 protected: 58 protected:
63 friend class base::RefCountedThreadSafe<AudioRendererSink>; 59 friend class base::RefCountedThreadSafe<AudioRendererSink>;
64 virtual ~AudioRendererSink() {} 60 virtual ~AudioRendererSink() {}
65 }; 61 };
66 62
67 } // namespace media 63 } // namespace media
68 64
69 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 65 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_
OLDNEW
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_render_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698