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

Unified Diff: media/base/audio_splicer.cc

Issue 405143003: Merge 279817 "Don't crash on splice frame failure with bad content." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 5 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 | « media/base/audio_splicer.h ('k') | media/base/audio_splicer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_splicer.cc
===================================================================
--- media/base/audio_splicer.cc (revision 284451)
+++ media/base/audio_splicer.cc (working copy)
@@ -16,12 +16,6 @@
namespace media {
-// Largest gap or overlap allowed by this class. Anything
-// larger than this will trigger an error.
-// This is an arbitrary value, but the initial selection of 50ms
-// roughly represents the duration of 2 compressed AAC or MP3 frames.
-static const int kMaxTimeDeltaInMilliseconds = 50;
-
// Minimum gap size needed before the splicer will take action to
// fill a gap. This avoids periodically inserting and then dropping samples
// when the buffer timestamps are slightly off because of timestamp rounding
@@ -143,7 +137,8 @@
output_timestamp_helper_.GetTimestamp();
const base::TimeDelta delta = timestamp - expected_timestamp;
- if (std::abs(delta.InMilliseconds()) > kMaxTimeDeltaInMilliseconds) {
+ if (std::abs(delta.InMilliseconds()) >
+ AudioSplicer::kMaxTimeDeltaInMilliseconds) {
DVLOG(1) << "Timestamp delta too large: " << delta.InMicroseconds() << "us";
return false;
}
@@ -310,7 +305,12 @@
if (pre_splice_sanitizer_->GetFrameCount() <=
output_ts_helper.GetFramesToTarget(splice_timestamp_)) {
CHECK(pre_splice_sanitizer_->DrainInto(output_sanitizer_.get()));
- CHECK(post_splice_sanitizer_->DrainInto(output_sanitizer_.get()));
+
+ // If the file contains incorrectly muxed timestamps, there may be huge gaps
+ // between the demuxed and decoded timestamps.
+ if (!post_splice_sanitizer_->DrainInto(output_sanitizer_.get()))
+ return false;
+
reset_splice_timestamps();
return true;
}
« no previous file with comments | « media/base/audio_splicer.h ('k') | media/base/audio_splicer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698