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

Unified Diff: media/base/audio_splicer.cc

Issue 339433006: Don't crash on splice frame failure with bad content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 6 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
diff --git a/media/base/audio_splicer.cc b/media/base/audio_splicer.cc
index 2fb4180ff9349b69d91aafbd61beb3a88dce9562..7fafc8bbbaca976eec83394d05847363c43afba0 100644
--- a/media/base/audio_splicer.cc
+++ b/media/base/audio_splicer.cc
@@ -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 @@ bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
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 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
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