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

Side by Side Diff: content/renderer/media/media_recorder_handler.cc

Issue 1812373002: MediaRecorder: ignored disabled audio/video tracks on MR start (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_recorder_handler.h" 5 #include "content/renderer/media/media_recorder_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 blink::WebVector<blink::WebMediaStreamTrack> video_tracks, audio_tracks; 128 blink::WebVector<blink::WebMediaStreamTrack> video_tracks, audio_tracks;
129 media_stream_.videoTracks(video_tracks); 129 media_stream_.videoTracks(video_tracks);
130 media_stream_.audioTracks(audio_tracks); 130 media_stream_.audioTracks(audio_tracks);
131 131
132 if (video_tracks.isEmpty() && audio_tracks.isEmpty()) { 132 if (video_tracks.isEmpty() && audio_tracks.isEmpty()) {
133 LOG(WARNING) << __FUNCTION__ << ": no media tracks."; 133 LOG(WARNING) << __FUNCTION__ << ": no media tracks.";
134 return false; 134 return false;
135 } 135 }
136 136
137 const bool use_video_tracks =
138 !video_tracks.isEmpty() && video_tracks[0].isEnabled();
137 const bool use_audio_tracks = 139 const bool use_audio_tracks =
138 !audio_tracks.isEmpty() && MediaStreamAudioTrack::From(audio_tracks[0]); 140 !audio_tracks.isEmpty() && MediaStreamAudioTrack::From(audio_tracks[0])
141 && audio_tracks[0].isEnabled();
139 142
140 webm_muxer_.reset(new media::WebmMuxer( 143 webm_muxer_.reset(new media::WebmMuxer(
141 use_vp9_ ? media::kCodecVP9 : media::kCodecVP8, 144 use_vp9_ ? media::kCodecVP9 : media::kCodecVP8, use_video_tracks,
142 video_tracks.size() > 0, use_audio_tracks, 145 use_audio_tracks, base::Bind(&MediaRecorderHandler::WriteData,
143 base::Bind(&MediaRecorderHandler::WriteData, 146 weak_factory_.GetWeakPtr())));
144 weak_factory_.GetWeakPtr())));
145 147
146 if (!video_tracks.isEmpty()) { 148 if (use_video_tracks) {
147 // TODO(mcasas): The muxer API supports only one video track. Extend it to 149 // TODO(mcasas): The muxer API supports only one video track. Extend it to
148 // several video tracks, see http://crbug.com/528523. 150 // several video tracks, see http://crbug.com/528523.
149 LOG_IF(WARNING, video_tracks.size() > 1u) 151 LOG_IF(WARNING, video_tracks.size() > 1u)
150 << "Recording multiple video tracks is not implemented. " 152 << "Recording multiple video tracks is not implemented. "
151 << "Only recording first video track."; 153 << "Only recording first video track.";
152 const blink::WebMediaStreamTrack& video_track = video_tracks[0]; 154 const blink::WebMediaStreamTrack& video_track = video_tracks[0];
153 if (video_track.isNull()) 155 if (video_track.isNull())
154 return false; 156 return false;
155 157
156 const VideoTrackRecorder::OnEncodedVideoCB on_encoded_video_cb = 158 const VideoTrackRecorder::OnEncodedVideoCB on_encoded_video_cb =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 recorder->OnData(audio_bus, timestamp); 262 recorder->OnData(audio_bus, timestamp);
261 } 263 }
262 264
263 void MediaRecorderHandler::SetAudioFormatForTesting( 265 void MediaRecorderHandler::SetAudioFormatForTesting(
264 const media::AudioParameters& params) { 266 const media::AudioParameters& params) {
265 for (auto* recorder : audio_recorders_) 267 for (auto* recorder : audio_recorders_)
266 recorder->OnSetFormat(params); 268 recorder->OnSetFormat(params);
267 } 269 }
268 270
269 } // namespace content 271 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698