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

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

Issue 90743004: Add generic interfaces for the sinks of the media stream audio track (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the nits. Created 7 years 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
Index: content/renderer/media/webrtc_local_audio_renderer.h
diff --git a/content/renderer/media/webrtc_local_audio_renderer.h b/content/renderer/media/webrtc_local_audio_renderer.h
index 8e8c96dad8a08add3a35009fb690cbdadf39ade5..e9871ece81b5c21a4439b5ae3a0b9540d67a1247 100644
--- a/content/renderer/media/webrtc_local_audio_renderer.h
+++ b/content/renderer/media/webrtc_local_audio_renderer.h
@@ -13,9 +13,11 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
+#include "content/public/renderer/media_stream_audio_sink.h"
#include "content/renderer/media/media_stream_audio_renderer.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "content/renderer/media/webrtc_local_audio_track.h"
+#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
namespace media {
class AudioBus;
@@ -34,7 +36,7 @@ class WebRtcAudioCapturer;
// It also implements media::AudioRendererSink::RenderCallback to render audio
// data provided from a WebRtcLocalAudioTrack source.
// When the audio layer in the browser process asks for data to render, this
-// class provides the data by implementing the WebRtcAudioCapturerSink
+// class provides the data by implementing the MediaStreamAudioSink
// interface, i.e., we are a sink seen from the WebRtcAudioCapturer perspective.
// TODO(henrika): improve by using similar principles as in RTCVideoRenderer
// which register itself to the video track when the provider is started and
@@ -42,13 +44,13 @@ class WebRtcAudioCapturer;
// Tracking this at http://crbug.com/164813.
class CONTENT_EXPORT WebRtcLocalAudioRenderer
: NON_EXPORTED_BASE(public MediaStreamAudioRenderer),
- NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback),
- NON_EXPORTED_BASE(public WebRtcAudioCapturerSink) {
+ NON_EXPORTED_BASE(public MediaStreamAudioSink),
+ NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback) {
public:
// Creates a local renderer and registers a capturing |source| object.
// The |source| is owned by the WebRtcAudioDeviceImpl.
// Called on the main thread.
- WebRtcLocalAudioRenderer(WebRtcLocalAudioTrack* audio_track,
+ WebRtcLocalAudioRenderer(const blink::WebMediaStreamTrack& audio_track,
int source_render_view_id,
int session_id,
int frames_per_buffer);
@@ -71,21 +73,16 @@ class CONTENT_EXPORT WebRtcLocalAudioRenderer
virtual ~WebRtcLocalAudioRenderer();
private:
- // WebRtcAudioCapturerSink implementation.
+ // MediaStreamAudioSink implementation.
// Called on the AudioInputDevice worker thread.
- virtual int CaptureData(const std::vector<int>& channels,
- const int16* audio_data,
- int sample_rate,
- int number_of_channels,
- int number_of_frames,
- int audio_delay_milliseconds,
- int current_volume,
- bool need_audio_processing,
- bool key_pressed) OVERRIDE;
-
- // Can be called on different user thread.
- virtual void SetCaptureFormat(const media::AudioParameters& params) OVERRIDE;
+ virtual void OnData(const int16* audio_data,
+ int sample_rate,
+ int number_of_channels,
+ int number_of_frames) OVERRIDE;
+
+ // Called on the AudioInputDevice worker thread.
+ virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE;
// media::AudioRendererSink::RenderCallback implementation.
// Render() is called on the AudioOutputDevice thread and OnRenderError()
@@ -108,8 +105,10 @@ class CONTENT_EXPORT WebRtcLocalAudioRenderer
// instance like a selected microphone and forwards the recorded data to its
// sinks. The recorded data is stored in a FIFO and consumed
// by this class when the sink asks for new data.
- // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl.
- scoped_refptr<WebRtcLocalAudioTrack> audio_track_;
+ // This class is calling MediaStreamAudioSink::AddToAudioTrack() and
+ // MediaStreamAudioSink::RemoveFromAudioTrack() to connect and disconnect
+ // with the audio track.
+ blink::WebMediaStreamTrack audio_track_;
// The render view in which the audio is rendered into |sink_|.
const int source_render_view_id_;
« no previous file with comments | « content/renderer/media/webrtc_audio_device_unittest.cc ('k') | content/renderer/media/webrtc_local_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698