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

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

Issue 2004723002: Handle ReadyStateEnded in MediaRecorderHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 const bool use_video_tracks = 170 const bool use_video_tracks =
171 !video_tracks.isEmpty() && video_tracks[0].isEnabled() && 171 !video_tracks.isEmpty() && video_tracks[0].isEnabled() &&
172 video_tracks[0].source().getReadyState() != 172 video_tracks[0].source().getReadyState() !=
173 blink::WebMediaStreamSource::ReadyStateEnded; 173 blink::WebMediaStreamSource::ReadyStateEnded;
174 const bool use_audio_tracks = 174 const bool use_audio_tracks =
175 !audio_tracks.isEmpty() && MediaStreamAudioTrack::From(audio_tracks[0]) && 175 !audio_tracks.isEmpty() && MediaStreamAudioTrack::From(audio_tracks[0]) &&
176 audio_tracks[0].isEnabled() && 176 audio_tracks[0].isEnabled() &&
177 audio_tracks[0].source().getReadyState() != 177 audio_tracks[0].source().getReadyState() !=
178 blink::WebMediaStreamSource::ReadyStateEnded; 178 blink::WebMediaStreamSource::ReadyStateEnded;
179 179
180 if (!use_video_tracks && !use_audio_tracks) {
181 LOG(WARNING) << __FUNCTION__ << ": no tracks to be recorded.";
182 return false;
183 }
184
180 webm_muxer_.reset(new media::WebmMuxer( 185 webm_muxer_.reset(new media::WebmMuxer(
181 CodecIdToMediaVideoCodec(codec_id_), use_video_tracks, use_audio_tracks, 186 CodecIdToMediaVideoCodec(codec_id_), use_video_tracks, use_audio_tracks,
182 base::Bind(&MediaRecorderHandler::WriteData, 187 base::Bind(&MediaRecorderHandler::WriteData,
183 weak_factory_.GetWeakPtr()))); 188 weak_factory_.GetWeakPtr())));
184 189
185 if (use_video_tracks) { 190 if (use_video_tracks) {
186 // TODO(mcasas): The muxer API supports only one video track. Extend it to 191 // TODO(mcasas): The muxer API supports only one video track. Extend it to
187 // several video tracks, see http://crbug.com/528523. 192 // several video tracks, see http://crbug.com/528523.
188 LOG_IF(WARNING, video_tracks.size() > 1u) 193 LOG_IF(WARNING, video_tracks.size() > 1u)
189 << "Recording multiple video tracks is not implemented. " 194 << "Recording multiple video tracks is not implemented. "
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 recorder->OnData(audio_bus, timestamp); 311 recorder->OnData(audio_bus, timestamp);
307 } 312 }
308 313
309 void MediaRecorderHandler::SetAudioFormatForTesting( 314 void MediaRecorderHandler::SetAudioFormatForTesting(
310 const media::AudioParameters& params) { 315 const media::AudioParameters& params) {
311 for (auto* recorder : audio_recorders_) 316 for (auto* recorder : audio_recorders_)
312 recorder->OnSetFormat(params); 317 recorder->OnSetFormat(params);
313 } 318 }
314 319
315 } // namespace content 320 } // 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