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

Unified Diff: media/base/audio_splicer.cc

Issue 440803002: Don't crash when splices are in the past due to bad media. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | 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 7fafc8bbbaca976eec83394d05847363c43afba0..0c8ac343324efa8720241e322d42b222318ac7bc 100644
--- a/media/base/audio_splicer.cc
+++ b/media/base/audio_splicer.cc
@@ -302,8 +302,10 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
// If a splice frame was incorrectly marked due to poor demuxed timestamps, we
// may not actually have a splice. Here we check if any frames exist before
// the splice. In this case, just transfer all data to the output sanitizer.
- if (pre_splice_sanitizer_->GetFrameCount() <=
wolenetz 2014/08/05 01:00:28 I'm trying to grok which part of this condition pr
DaleCurtis 2014/08/05 01:03:10 If frames_before_splice is negative this condition
wolenetz 2014/08/07 23:12:12 Acknowledged.
- output_ts_helper.GetFramesToTarget(splice_timestamp_)) {
+ const int frames_before_splice =
+ output_ts_helper.GetFramesToTarget(splice_timestamp_);
+ if (frames_before_splice < 0 ||
+ pre_splice_sanitizer_->GetFrameCount() <= frames_before_splice) {
CHECK(pre_splice_sanitizer_->DrainInto(output_sanitizer_.get()));
// If the file contains incorrectly muxed timestamps, there may be huge gaps
« no previous file with comments | « no previous file | media/base/audio_splicer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698