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

Unified Diff: chrome/renderer/extensions/cast_streaming_native_handler.cc

Issue 1721273002: MediaStream audio object graph untangling and clean-ups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 4 years, 9 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 | « no previous file | content/public/renderer/media_stream_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/cast_streaming_native_handler.cc
diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.cc b/chrome/renderer/extensions/cast_streaming_native_handler.cc
index 23ff219654c86eb48896a41f7e47423b95d36ea7..72bf8059c1c19c28ef501d705914fc307db6dafc 100644
--- a/chrome/renderer/extensions/cast_streaming_native_handler.cc
+++ b/chrome/renderer/extensions/cast_streaming_native_handler.cc
@@ -802,10 +802,9 @@ void CastStreamingNativeHandler::StartCastRtpReceiver(
media::AudioParameters params(
media::AudioParameters::AUDIO_PCM_LINEAR,
- media::CHANNEL_LAYOUT_STEREO,
+ media::GuessChannelLayout(audio_config.channels),
audio_config.rtp_timebase, // sampling rate
- 16,
- audio_config.rtp_timebase / audio_config.target_frame_rate);
+ 16, audio_config.rtp_timebase / audio_config.target_frame_rate);
if (!params.IsValid()) {
args.GetIsolate()->ThrowException(v8::Exception::TypeError(
@@ -863,8 +862,24 @@ void CastStreamingNativeHandler::AddTracksToMediaStream(
const media::AudioParameters& params,
scoped_refptr<media::AudioCapturerSource> audio,
scoped_ptr<media::VideoCapturerSource> video) {
- content::AddAudioTrackToMediaStream(audio, params, true, true, url);
- content::AddVideoTrackToMediaStream(std::move(video), true, true, url);
+ blink::WebMediaStream web_stream =
+ blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(GURL(url));
+ if (web_stream.isNull()) {
+ LOG(DFATAL) << "Stream not found.";
+ return;
+ }
+ if (!content::AddAudioTrackToMediaStream(
+ audio, params.sample_rate(), params.channel_layout(),
+ params.frames_per_buffer(), true, // is_remote
+ true, // is_readonly
+ &web_stream)) {
+ LOG(ERROR) << "Failed to add Cast audio track to media stream.";
+ }
+ if (!content::AddVideoTrackToMediaStream(std::move(video), true, // is_remote
+ true, // is_readonly
+ &web_stream)) {
+ LOG(ERROR) << "Failed to add Cast video track to media stream.";
+ }
}
} // namespace extensions
« no previous file with comments | « no previous file | content/public/renderer/media_stream_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698