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

Unified Diff: media/mp4/mp4_stream_parser.cc

Issue 10821081: Move 'mdat' advancement logic to make more sense. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/mp4_stream_parser.cc
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 9d51959a3a32bbc8d45c0c4db8370c80e1093737..2b5eea3fd91c0ec809fe3082d442911b26ecacab 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698