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

Unified Diff: content/renderer/media/media_stream_audio_processor.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: addressed Per's comments. 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
Index: content/renderer/media/media_stream_audio_processor.h
diff --git a/content/renderer/media/media_stream_audio_processor.h b/content/renderer/media/media_stream_audio_processor.h
index be5b8b0409ea82d73e22cab068a0dbe8ce68282e..680505baf64ad62b5f9e361ffeb3fa020b7a1f0f 100644
--- a/content/renderer/media/media_stream_audio_processor.h
+++ b/content/renderer/media/media_stream_audio_processor.h
@@ -10,6 +10,7 @@
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
+#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "media/base/audio_converter.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h"
#include "third_party/webrtc/modules/interface/module_common_types.h"
@@ -37,27 +38,18 @@ class RTCMediaConstraints;
// on the getUserMedia constraints, processes the data and outputs it in a unit
// of 10 ms data chunk.
class CONTENT_EXPORT MediaStreamAudioProcessor :
- public base::RefCountedThreadSafe<MediaStreamAudioProcessor> {
+ public base::RefCountedThreadSafe<MediaStreamAudioProcessor>,
+ public WebRtcAudioRendererSource {
public:
MediaStreamAudioProcessor(const media::AudioParameters& source_params,
const blink::WebMediaConstraints& constraints,
- int effects);
+ int effects,
+ WebRtcAudioDeviceImpl* audio_device);
miu 2014/01/24 22:27:19 Please comment this ctor to note that |audio_devic
miu 2014/01/24 22:27:19 Also, should you be using WebRtcAudioRendererSourc
no longer working on chromium 2014/01/27 17:09:33 Done with adding a comment to explain what |audio_
no longer working on chromium 2014/01/27 17:09:33 audio_device_->AddRenderDataObserver() and audio_d
// Pushes capture data in |audio_source| to the internal FIFO.
// Called on the capture audio thread.
void PushCaptureData(media::AudioBus* audio_source);
- // Push the render audio to webrtc::AudioProcessing for analysis. This is
- // needed iff echo processing is enabled.
- // |render_audio| is the pointer to the render audio data, its format
- // is specified by |sample_rate|, |number_of_channels| and |number_of_frames|.
- // Called on the render audio thread.
- void PushRenderData(const int16* render_audio,
- int sample_rate,
- int number_of_channels,
- int number_of_frames,
- base::TimeDelta render_delay);
-
// Processes a block of 10 ms data from the internal FIFO and outputs it via
// |out|. |out| is the address of the pointer that will be pointed to
// the post-processed data if the method is returning a true. The lifetime
@@ -90,6 +82,12 @@ class CONTENT_EXPORT MediaStreamAudioProcessor :
private:
class MediaStreamAudioConverter;
+ // WebRtcAudioRendererSource implementation.
+ virtual void RenderData(media::AudioBus* audio_bus,
+ int sample_rate,
+ int audio_delay_milliseconds) OVERRIDE;
+ virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE;
+
// Helper to initialize the WebRtc AudioProcessing.
void InitializeAudioProcessingModule(
const blink::WebMediaConstraints& constraints, int effects);
@@ -135,8 +133,9 @@ class CONTENT_EXPORT MediaStreamAudioProcessor :
// Data bus to help converting interleaved data to an AudioBus.
scoped_ptr<media::AudioBus> render_data_bus_;
- // Used to DCHECK that some methods are called on the main render thread.
- base::ThreadChecker main_thread_checker_;
+ // Raw pointer to the WebRtcAudioDeviceImpl, which is valid for the lifetime
+ // of RenderThread.
+ WebRtcAudioDeviceImpl* audio_device_;
miu 2014/01/24 22:27:19 nit: Should be: WebRtcAudioDeviceImpl* const au
no longer working on chromium 2014/01/27 17:09:33 Done.
// Used to DCHECK that some methods are called on the capture audio thread.
base::ThreadChecker capture_thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698