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

Unified Diff: content/renderer/media/webrtc_audio_device_impl.h

Issue 139303016: Feed the render data to MediaStreamAudioProcessor and used AudioBus in render callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the unittests, ready for review now. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | content/renderer/media/webrtc_audio_device_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_audio_device_impl.h
diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h
index f9279f5f6ff5c4986b1afd62e5223228426ae690..7ae27141968642d3ffd437c2589d5a5e678cfda0 100644
--- a/content/renderer/media/webrtc_audio_device_impl.h
+++ b/content/renderer/media/webrtc_audio_device_impl.h
@@ -186,15 +186,10 @@ class WebRtcAudioRenderer;
class WebRtcAudioRendererSource {
public:
// Callback to get the rendered interleaved data.
- // TODO(xians): Change uint8* to int16*.
- virtual void RenderData(uint8* audio_data,
- int number_of_channels,
- int number_of_frames,
+ virtual void RenderData(media::AudioBus* audio_bus,
+ int sample_rate,
int audio_delay_milliseconds) = 0;
- // Set the format for the capture audio parameters.
- virtual void SetRenderFormat(const media::AudioParameters& params) = 0;
-
// Callback to notify the client that the renderer is going away.
virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) = 0;
@@ -235,7 +230,7 @@ class PeerConnectionAudioSink {
virtual ~PeerConnectionAudioSink() {}
};
-// Note that this class inherits from webrtc::AudioDeviceModule but due to
+//Note that this class inherits from webrtc::AudioDeviceModule but due to
perkj_chrome 2014/01/20 12:29:35 nit indentation
no longer working on chromium 2014/01/23 13:02:30 Done.
// the high number of non-implemented methods, we move the cruft over to the
// WebRtcAudioDeviceNotImpl.
class CONTENT_EXPORT WebRtcAudioDeviceImpl
@@ -305,6 +300,12 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer);
void RemoveAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer);
+ // Adds/Removes the observer of WebRtcAudioRendererSource to the ADM.
+ // These methods are used by the MediaStreamAudioProcesssor to get the
+ // render data for AEC.
+ void AddRenderDataObserver(WebRtcAudioRendererSource* observer);
perkj_chrome 2014/01/20 12:29:35 I am a bit confused about the audio naming convent
no longer working on chromium 2014/01/23 13:02:30 Do you have any other suggestion on the naming her
+ void RemoveRenderDataObserver(WebRtcAudioRendererSource* observer);
+
// Gets paired device information of the capture device for the audio
// renderer. This is used to pass on a session id, sample rate and buffer
// size to a webrtc audio renderer (either local or remote), so that audio
@@ -318,18 +319,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
const scoped_refptr<WebRtcAudioRenderer>& renderer() const {
return renderer_;
}
- int output_buffer_size() const {
- return output_audio_parameters_.frames_per_buffer();
- }
- int output_channels() const {
- return output_audio_parameters_.channels();
- }
- int output_sample_rate() const {
- return output_audio_parameters_.sample_rate();
- }
private:
typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList;
+ typedef std::list<WebRtcAudioRendererSource* > RenderDataObservers;
+ class RenderBuffer;
// Make destructor private to ensure that we can only be deleted by Release().
virtual ~WebRtcAudioDeviceImpl();
@@ -353,13 +347,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// WebRtcAudioRendererSource implementation.
// Called on the AudioInputDevice worker thread.
- virtual void RenderData(uint8* audio_data,
- int number_of_channels,
- int number_of_frames,
+ virtual void RenderData(media::AudioBus* audio_bus,
+ int sample_rate,
int audio_delay_milliseconds) OVERRIDE;
// Called on the main render thread.
- virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE;
virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE;
// Helper to get the default capturer, which is the last capturer in
@@ -378,14 +370,14 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// Provides access to the audio renderer in the browser process.
scoped_refptr<WebRtcAudioRenderer> renderer_;
+ // List of observers which requires access to the render data.
perkj_chrome 2014/01/20 12:29:35 render data? Is this the audio that will be played
no longer working on chromium 2014/01/23 13:02:30 Yes.
+ RenderDataObservers render_data_observers_;
+
// Weak reference to the audio callback.
// The webrtc client defines |audio_transport_callback_| by calling
// RegisterAudioCallback().
webrtc::AudioTransport* audio_transport_callback_;
- // Cached values of used output audio parameters. Platform dependent.
- media::AudioParameters output_audio_parameters_;
-
// Cached value of the current audio delay on the input/capture side.
int input_delay_ms_;
@@ -400,6 +392,7 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// than one input stream calling OnData().
mutable base::Lock capture_callback_lock_;
+ //
perkj_chrome 2014/01/20 12:29:35 ?
bool initialized_;
bool playing_;
bool recording_;
@@ -412,6 +405,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// Range is [0, 255].
uint32_t microphone_volume_;
+ // Buffer used for temporary storage during render callback.
+ // It is only accessed by the audio render thread.
+ scoped_ptr<int16[]> render_buffer_;
+ int render_buffer_size_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
};
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | content/renderer/media/webrtc_audio_device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698