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

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

Issue 1647773002: MediaStream audio sourcing: Bypass audio processing for non-WebRTC cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT FOR REVIEW -- This will be broken-up across multiple CLs. Created 4 years, 10 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/content_renderer.gypi » ('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..011e1fde1cdac2798fe924127f814df518f1bef1 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,23 @@ 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/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698