Commit 9ee0310a authored by strobe@google.com's avatar strobe@google.com

Move 'mdat' advancement logic to make more sense.

This defers the change from kEmittingSamples to kParsingBoxes until after the
current 'mdat' atom has been cleared in MP4StreamParser.

BUG=
TEST=MP4StreamParserTest


Review URL: https://chromiumcodereview.appspot.com/10821081

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148977 0039d316-1c4b-4281-b951-d872f2087c98
parent 0a2603c2
......@@ -80,11 +80,7 @@ bool MP4StreamParser::Parse(const uint8* buf, int size) {
do {
if (state_ == kParsingBoxes) {
if (mdat_tail_ > queue_.head()) {
result = queue_.Trim(mdat_tail_);
} else {
result = ParseBox(&err);
}
result = ParseBox(&err);
} else {
DCHECK_EQ(kEmittingSamples, state_);
result = EnqueueSample(&audio_buffers, &video_buffers, &err);
......@@ -322,6 +318,11 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
if (*err)
return false;
// Remain in kEnqueueingSamples state, discarding data, until the end of
// the current 'mdat' box has been appended to the queue.
if (!queue_.Trim(mdat_tail_))
return false;
ChangeState(kParsingBoxes);
end_of_segment_cb_.Run();
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment