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

Unified Diff: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp

Issue 1682483002: MediaRecorder: remove ASSERTS in bitrate clamping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
index 32a1901096c08ededa83c0d82267ed95d2305fe5..15200b5d9ac8f2e56bc764c79b93c39b3ce3fff1 100644
--- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
+++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -56,15 +56,8 @@ void AllocateVideoAndAudioBitrates(ExceptionState& exceptionState, ExecutionCont
// TODO(mcasas): This section would no be needed if the bit rates are signed or double, see https://github.com/w3c/mediacapture-record/issues/48.
const unsigned kMaxIntAsUnsigned = std::numeric_limits<int>::max();
- ASSERT(options.bitsPerSecond() >= 0);
- ASSERT(options.bitsPerSecond() < kMaxIntAsUnsigned);
const int overallBps = std::min(options.bitsPerSecond(), kMaxIntAsUnsigned);
philipj_slow 2016/02/09 06:31:22 Can you write test cases that exercise this clampi
mcasas 2016/02/12 02:11:38 Done, added a few more LayoutTests.
-
- // If options.hasBitsPerSecond() is not present, assert than the individual |{video,audio}BitsPerSecond| are smaller than the maximum.
- ASSERT(!options.hasBitsPerSecond() || options.videoBitsPerSecond() < kMaxIntAsUnsigned);
int videoBps = std::min(options.videoBitsPerSecond(), kMaxIntAsUnsigned);
-
- ASSERT(!options.hasBitsPerSecond() || options.audioBitsPerSecond() < kMaxIntAsUnsigned);
int audioBps = std::min(options.audioBitsPerSecond(), kMaxIntAsUnsigned);
const bool useVideo = !stream->getVideoTracks().isEmpty();
@@ -97,7 +90,7 @@ void AllocateVideoAndAudioBitrates(ExceptionState& exceptionState, ExecutionCont
// Allocate the remaining |overallBps|, if any, to video.
if (overallBps)
videoBps = overallBps - audioBps;
- // Clamp the video bit rate if the user has set it explicitly or has used the overall bitrate.
+ // Clamp the video bit rate. Avoid clamping if the user has not set it explicitly.
if ((options.videoBitsPerSecond() > 0 || overallBps > 0) && (videoBps < kSmallestPossibleVpxBitRate)) {
mcasas 2016/02/08 21:55:56 From https://codereview.chromium.org/1652373004/:
philipj_slow 2016/02/09 06:31:22 The trouble is that because MediaRecorderOptions.i
mcasas 2016/02/12 02:11:38 I see. I removed the by-default =0 in MediaRecorde
context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "Clamping calculated video bitrate (" + String::number(videoBps) + "bps) to the minimum (" + String::number(kSmallestPossibleVpxBitRate) + "bps)"));
videoBps = kSmallestPossibleVpxBitRate;
« 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