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

Unified Diff: media/formats/mp4/mp4_stream_parser.h

Issue 348623003: Fix muxed MP4 parsing so it won't crash on partial media segment appends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix run skipping bug. 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 | « no previous file | media/formats/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/mp4_stream_parser.h
diff --git a/media/formats/mp4/mp4_stream_parser.h b/media/formats/mp4/mp4_stream_parser.h
index 36613b3dbb73dc94aec29ccdccaa7356b3b91ccf..4923ab9582a7c21f7c8f2f72cb08ff3439714f48 100644
--- a/media/formats/mp4/mp4_stream_parser.h
+++ b/media/formats/mp4/mp4_stream_parser.h
@@ -42,6 +42,7 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
enum State {
kWaitingForInit,
kParsingBoxes,
+ kWaitingForSampleData,
kEmittingSamples,
kError
};
@@ -78,6 +79,15 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
void Reset();
+ // Checks to see if we have enough data in |queue_| to transition to
+ // kEmittingSamples and start enqueuing samples.
+ bool HaveEnoughDataToEnqueueSamples();
+
+ // Sets |highest_end_offset_| based on the data in |moov_|
+ // and |moof|. Returns true if |highest_end_offset_| was successfully
+ // computed.
+ bool ComputeHighestEndOffset(const MovieFragment& moof);
+
State state_;
InitCB init_cb_;
NewConfigCB config_cb_;
@@ -99,6 +109,11 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
// Valid iff it is greater than the head of the queue.
int64 mdat_tail_;
+ // The highest end offset in the current moof. This offset is
+ // relative to |moof_head_|. This value is used to make sure we have collected
+ // enough bytes to parse all samples and aux_info in the current moof.
+ int64 highest_end_offset_;
+
scoped_ptr<mp4::Movie> moov_;
scoped_ptr<mp4::TrackRunIterator> runs_;
« no previous file with comments | « no previous file | media/formats/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698