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

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

Issue 1782043003: MediaRecorder: produce keyframes more often (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/video_track_recorder.h" 5 #include "content/renderer/media/video_track_recorder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // frame rate or to e.g. microseconds. 319 // frame rate or to e.g. microseconds.
320 codec_config_.g_timebase.num = 1; 320 codec_config_.g_timebase.num = 1;
321 codec_config_.g_timebase.den = base::Time::kMicrosecondsPerSecond; 321 codec_config_.g_timebase.den = base::Time::kMicrosecondsPerSecond;
322 322
323 // Let the encoder decide where to place the Keyframes, between min and max. 323 // Let the encoder decide where to place the Keyframes, between min and max.
324 // In VPX_KF_AUTO mode libvpx will sometimes emit keyframes regardless of min/ 324 // In VPX_KF_AUTO mode libvpx will sometimes emit keyframes regardless of min/
325 // max distance out of necessity. 325 // max distance out of necessity.
326 // Note that due to http://crbug.com/440223, it might be necessary to force a 326 // Note that due to http://crbug.com/440223, it might be necessary to force a
327 // key frame after 10,000frames since decoding fails after 30,000 non-key 327 // key frame after 10,000frames since decoding fails after 30,000 non-key
328 // frames. 328 // frames.
329 // Forcing a keyframe in regular intervals also allows seeking in the
330 // resulting recording with decent performance.
329 codec_config_.kf_mode = VPX_KF_AUTO; 331 codec_config_.kf_mode = VPX_KF_AUTO;
330 codec_config_.kf_min_dist = 0; 332 codec_config_.kf_min_dist = 0;
331 codec_config_.kf_max_dist = 30000; 333 codec_config_.kf_max_dist = 100;
miu 2016/03/11 20:04:36 It seems that your goal is to generate a key frame
thembrown 2016/03/11 20:32:51 My goal was mainly to introduce a upper bound for
miu 2016/03/12 02:01:28 SGTM.
332 334
333 // Do not saturate CPU utilization just for encoding. On a lower-end system 335 // Do not saturate CPU utilization just for encoding. On a lower-end system
334 // with only 1 or 2 cores, use only one thread for encoding. On systems with 336 // with only 1 or 2 cores, use only one thread for encoding. On systems with
335 // more cores, allow half of the cores to be used for encoding. 337 // more cores, allow half of the cores to be used for encoding.
336 codec_config_.g_threads = 338 codec_config_.g_threads =
337 std::min(8, (base::SysInfo::NumberOfProcessors() + 1) / 2); 339 std::min(8, (base::SysInfo::NumberOfProcessors() + 1) / 2);
338 340
339 // Number of frames to consume before producing output. 341 // Number of frames to consume before producing output.
340 codec_config_.g_lag_in_frames = 0; 342 codec_config_.g_lag_in_frames = 0;
341 343
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 encoder_->set_paused(false); 415 encoder_->set_paused(false);
414 } 416 }
415 417
416 void VideoTrackRecorder::OnVideoFrameForTesting( 418 void VideoTrackRecorder::OnVideoFrameForTesting(
417 const scoped_refptr<media::VideoFrame>& frame, 419 const scoped_refptr<media::VideoFrame>& frame,
418 base::TimeTicks timestamp) { 420 base::TimeTicks timestamp) {
419 encoder_->StartFrameEncode(frame, timestamp); 421 encoder_->StartFrameEncode(frame, timestamp);
420 } 422 }
421 423
422 } // namespace content 424 } // 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