Skip to content

Commit

Permalink
MediaStreamTrack: don't wait to record MediaStreamTrack's whose state…
Browse files Browse the repository at this point in the history
… is not 'live'

A MSTrack on which stop() has been called has state 'ended'.
With this CL MR avoids waiting for those Tracks.

BUG=596178
TEST= See bug chromium#1:

Steps to reproduce:
1- Go to https://cdn.rawgit.com/cricdecyan/mediarecorder/master/manualtest/index.html
 (note: needs either --enable-blink-features=GetUserMedia flag or
 chrome://flags -> Experimental Web Platform features enabled)
2- Click on GetUserMedia
3- Click on StopLocalAudioTracks to disable all audio tracks.
4- Click on CreateRecorder
5- Click on Start

Review URL: https://codereview.chromium.org/1824933005

Cr-Commit-Position: refs/heads/master@{#382697}
  • Loading branch information
yell0wd0g authored and Commit bot committed Mar 22, 2016
1 parent 6ce8049 commit 2181b9d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions content/renderer/media/media_recorder_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "media/base/video_frame.h"
#include "media/muxers/webm_muxer.h"
#include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebString.h"

using base::TimeDelta;
Expand Down Expand Up @@ -134,11 +135,15 @@ bool MediaRecorderHandler::start(int timeslice) {
return false;
}

const bool use_video_tracks =
!video_tracks.isEmpty() && video_tracks[0].isEnabled();
const bool use_audio_tracks =
!audio_tracks.isEmpty() && MediaStreamAudioTrack::From(audio_tracks[0])
&& audio_tracks[0].isEnabled();
const bool use_video_tracks = !video_tracks.isEmpty() &&
video_tracks[0].isEnabled() &&
video_tracks[0].source().getReadyState() ==
blink::WebMediaStreamSource::ReadyStateLive;
const bool use_audio_tracks = !audio_tracks.isEmpty() &&
MediaStreamAudioTrack::From(audio_tracks[0]) &&
audio_tracks[0].isEnabled() &&
audio_tracks[0].source().getReadyState() ==
blink::WebMediaStreamSource::ReadyStateLive;

webm_muxer_.reset(new media::WebmMuxer(
use_vp9_ ? media::kCodecVP9 : media::kCodecVP8, use_video_tracks,
Expand Down

0 comments on commit 2181b9d

Please sign in to comment.