summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authormcasas <mcasas@chromium.org>2015-12-10 10:44:00 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-10 18:44:55 +0000
commit7fbd58cd9969b2b821b10f75dcbb0888ac83fa78 (patch)
tree4b14e2670dbecadaa8e44374a16fdd1c128c4acd /content/renderer
parentdea09d3b7ac5fd50ca7ba3baa70fb37920895487 (diff)
downloadchromium_src-7fbd58cd9969b2b821b10f75dcbb0888ac83fa78.zip
chromium_src-7fbd58cd9969b2b821b10f75dcbb0888ac83fa78.tar.gz
chromium_src-7fbd58cd9969b2b821b10f75dcbb0888ac83fa78.tar.bz2
MediaRecorder: avoid recording Remote Audio Tracks (unsupported), ignore them and log JS warning
http://crbug.com/344303 and line of code [1] prevents supporting such recording. While we figure out exactly what needs to be done for this, is better to record only Video than nothing at all, so this CL avoids recording Audio from Remote Tracks. [1] https://code.google.com/p/chromium/codesearch#chromium/src/content/public/renderer/media_stream_audio_sink.cc&q=media_stream_audio_sink&sq=package:chromium&type=cs&l=20 BUG=567960 TEST= Navigate to https://rawgit.com/webrtc/samples/gh-pages/src/content/peerconnection/pc1/index.html Press buttons 'Start' and 'Call' in succession, to establish a remote call. Open the JS console and copy/type var mr = new MediaRecorder(remoteVideo.srcObject); With this CL, a warning should pop up indicating that remote audio tracks are not supported. Type/copy: mr.ondataavailable=function(event){console.log("data available");}; mr.start(10) the JS console should start typing "data available" messages, whereas without this patch, no such messages would show up. Review URL: https://codereview.chromium.org/1506343004 Cr-Commit-Position: refs/heads/master@{#364411}
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/media/media_recorder_handler.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/content/renderer/media/media_recorder_handler.cc b/content/renderer/media/media_recorder_handler.cc
index 158f3df..dec9cbc 100644
--- a/content/renderer/media/media_recorder_handler.cc
+++ b/content/renderer/media/media_recorder_handler.cc
@@ -10,6 +10,7 @@
#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "content/renderer/media/audio_track_recorder.h"
+#include "content/renderer/media/media_stream_track.h"
#include "content/renderer/media/video_track_recorder.h"
#include "content/renderer/media/webrtc_uma_histograms.h"
#include "media/audio/audio_parameters.h"
@@ -113,9 +114,15 @@ bool MediaRecorderHandler::start(int timeslice) {
return false;
}
+ // We cannot add ourselves as sink to a remote audio track, see
+ // http://crbug.com/121673 and MediaStreamAudioSink::AddToAudioTrack();
+ const bool use_audio_tracks = !audio_tracks.isEmpty() &&
+ MediaStreamTrack::GetTrack(audio_tracks[0]) &&
+ MediaStreamTrack::GetTrack(audio_tracks[0])->is_local_track();
+
webm_muxer_.reset(new media::WebmMuxer(
use_vp9_ ? media::kCodecVP9 : media::kCodecVP8,
- video_tracks.size() > 0, audio_tracks.size() > 0,
+ video_tracks.size() > 0, use_audio_tracks,
base::Bind(&MediaRecorderHandler::WriteData,
weak_factory_.GetWeakPtr())));
@@ -137,7 +144,7 @@ bool MediaRecorderHandler::start(int timeslice) {
new VideoTrackRecorder(use_vp9_, video_track, on_encoded_video_cb));
}
- if (!audio_tracks.isEmpty()) {
+ if (use_audio_tracks) {
// TODO(ajose): The muxer API supports only one audio track. Extend it to
// several tracks.
LOG_IF(WARNING, audio_tracks.size() > 1u)