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

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

Issue 1414793002: Update WebmMuxer for audio component of MediaStream recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 1 month 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 | media/capture/webm_muxer.h » ('j') | media/capture/webm_muxer.cc » ('J')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/renderer/media/video_track_recorder.h" 10 #include "content/renderer/media/video_track_recorder.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool MediaRecorderHandler::start(int timeslice) { 73 bool MediaRecorderHandler::start(int timeslice) {
74 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 74 DCHECK(main_render_thread_checker_.CalledOnValidThread());
75 DCHECK(!recording_); 75 DCHECK(!recording_);
76 DCHECK(!media_stream_.isNull()); 76 DCHECK(!media_stream_.isNull());
77 DCHECK(!webm_muxer_); 77 DCHECK(!webm_muxer_);
78 DCHECK(timeslice_.is_zero()); 78 DCHECK(timeslice_.is_zero());
79 79
80 timeslice_ = TimeDelta::FromMilliseconds(timeslice); 80 timeslice_ = TimeDelta::FromMilliseconds(timeslice);
81 slice_origin_timestamp_ = TimeTicks::Now(); 81 slice_origin_timestamp_ = TimeTicks::Now();
82 82
83 webm_muxer_.reset(
84 new media::WebmMuxer(use_vp9_ ? media::kCodecVP9 : media::kCodecVP8,
85 base::Bind(&MediaRecorderHandler::WriteData,
86 weak_factory_.GetWeakPtr())));
87
88 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; 83 blink::WebVector<blink::WebMediaStreamTrack> video_tracks;
89 media_stream_.videoTracks(video_tracks); 84 media_stream_.videoTracks(video_tracks);
90 85
86 webm_muxer_.reset(new media::WebmMuxer(
87 use_vp9_ ? media::kCodecVP9 : media::kCodecVP8, video_tracks.size(),
88 0 /* no audio for now */, base::Bind(&MediaRecorderHandler::WriteData,
mcasas 2015/11/02 18:29:54 Please quote the bug that tracks the implementatio
ajose 2015/11/02 22:39:51 Done.
89 weak_factory_.GetWeakPtr())));
90
91 if (video_tracks.isEmpty()) { 91 if (video_tracks.isEmpty()) {
92 // TODO(mcasas): Add audio_tracks and update the code in this function 92 // TODO(mcasas): Add audio_tracks and update the code in this function
93 // correspondingly, see http://crbug.com/528519. As of now, only video 93 // correspondingly, see http://crbug.com/528519. As of now, only video
94 // tracks are supported. 94 // tracks are supported.
95 LOG(WARNING) << "Recording no video tracks is not implemented"; 95 LOG(WARNING) << "Recording no video tracks is not implemented";
96 return false; 96 return false;
97 } 97 }
98 // TODO(mcasas): The muxer API supports only one video track. Extend it to 98 // TODO(mcasas): The muxer API supports only one video track. Extend it to
99 // several video tracks, see http://crbug.com/528523. 99 // several video tracks, see http://crbug.com/528523.
100 LOG_IF(WARNING, video_tracks.size() > 1u) << "Recording multiple video" 100 LOG_IF(WARNING, video_tracks.size() > 1u) << "Recording multiple video"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 void MediaRecorderHandler::OnVideoFrameForTesting( 173 void MediaRecorderHandler::OnVideoFrameForTesting(
174 const scoped_refptr<media::VideoFrame>& frame, 174 const scoped_refptr<media::VideoFrame>& frame,
175 const TimeTicks& timestamp) { 175 const TimeTicks& timestamp) {
176 for (auto* recorder : video_recorders_) 176 for (auto* recorder : video_recorders_)
177 recorder->OnVideoFrameForTesting(frame, timestamp); 177 recorder->OnVideoFrameForTesting(frame, timestamp);
178 } 178 }
179 179
180 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/capture/webm_muxer.h » ('j') | media/capture/webm_muxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698