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

Unified Diff: content/public/renderer/media_stream_utils.cc

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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/content_tests.gypi ('k') | content/renderer/media/audio_track_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/renderer/media_stream_utils.cc
diff --git a/content/public/renderer/media_stream_utils.cc b/content/public/renderer/media_stream_utils.cc
index 07f25cabd1533d38edd30910ab0ef8a9187ba7bd..d05b08f5c86fe5281f613565d16aac927f6e71ae 100644
--- a/content/public/renderer/media_stream_utils.cc
+++ b/content/public/renderer/media_stream_utils.cc
@@ -11,11 +11,10 @@
#include "base/guid.h"
#include "base/rand_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "content/renderer/media/media_stream_audio_source.h"
+#include "content/renderer/media/external_media_stream_audio_source.h"
#include "content/renderer/media/media_stream_video_capturer_source.h"
#include "content/renderer/media/media_stream_video_source.h"
#include "content/renderer/media/media_stream_video_track.h"
-#include "content/renderer/render_thread_impl.h"
#include "media/base/audio_capturer_source.h"
#include "media/base/video_capturer_source.h"
#include "third_party/WebKit/public/platform/WebMediaStream.h"
@@ -83,32 +82,17 @@ bool AddAudioTrackToMediaStream(
web_media_stream_source.initialize(track_id,
blink::WebMediaStreamSource::TypeAudio,
track_id, is_remote);
-
- MediaStreamAudioSource* media_stream_source(new MediaStreamAudioSource(
- -1, StreamDeviceInfo(), MediaStreamSource::SourceStoppedCallback(),
- RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()));
-
- blink::WebMediaConstraints constraints;
- constraints.initialize();
- {
- // TODO(miu): In an upcoming change, a source purposed for passing audio
- // directly (i.e., without modification) will replace this "hacky" use of
- // WebRtcAudioCapturer. http://crbug.com/577881
- std::unique_ptr<WebRtcAudioCapturer> capturer(
- WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), constraints,
- nullptr, media_stream_source));
- capturer->SetCapturerSource(std::move(audio_source), params);
- media_stream_source->SetAudioCapturer(std::move(capturer));
- }
- web_media_stream_source.setExtraData(
- media_stream_source); // Takes ownership.
+ MediaStreamAudioSource* const media_stream_source =
+ new ExternalMediaStreamAudioSource(std::move(audio_source), sample_rate,
+ channel_layout, frames_per_buffer,
+ is_remote);
+ // Takes ownership of |media_stream_source|.
+ web_media_stream_source.setExtraData(media_stream_source);
blink::WebMediaStreamTrack web_media_stream_track;
web_media_stream_track.initialize(web_media_stream_source);
- RenderThreadImpl::current()
- ->GetPeerConnectionDependencyFactory()
- ->CreateLocalAudioTrack(web_media_stream_track);
-
+ if (!media_stream_source->ConnectToTrack(web_media_stream_track))
+ return false;
web_media_stream->addTrack(web_media_stream_track);
return true;
}
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/media/audio_track_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698