Skip to content

Commit

Permalink
Add some additional CHECKs for splicer behavior.
Browse files Browse the repository at this point in the history
Replaces a null pointer exception with a CHECK() failure and adds
some additional verification for the first post splice buffer.

BUG=356073,369204
TEST=tests still pass.
TBR=acolwell

Review URL: https://codereview.chromium.org/264973010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268124 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dalecurtis@chromium.org committed May 4, 2014
1 parent f7fa611 commit 7c9907b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion media/base/audio_splicer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {

// The first post splice buffer is expected to match |splice_timestamp_|.
if (!post_splice_sanitizer_->HasNextBuffer())
DCHECK(splice_timestamp_ == input->timestamp());
CHECK(splice_timestamp_ == input->timestamp());

// At this point we have all the fade out preroll buffers from the decoder.
// We now need to wait until we have enough data to perform the crossfade (or
Expand Down Expand Up @@ -434,6 +434,12 @@ scoped_ptr<AudioBus> AudioSplicer::ExtractCrossfadeFromPreSplice(
}
}

// Ensure outputs were properly allocated. The method should not have been
// called if there is not enough data to crossfade.
// TODO(dalecurtis): Convert to DCHECK() once http://crbug.com/356073 fixed.
CHECK(output_bus);
CHECK(*crossfade_buffer);

// All necessary buffers have been processed, it's safe to reset.
pre_splice_sanitizer_->Reset();
DCHECK_EQ(output_bus->frames(), frames_read);
Expand Down

0 comments on commit 7c9907b

Please sign in to comment.