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

Unified Diff: media/mp4/mp4_stream_parser.cc

Issue 10843044: Fix sourceAbort() for BMFF streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « media/mp4/mp4_stream_parser.h ('k') | media/mp4/mp4_stream_parser_unittest.cc » ('j') | 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 67264f48b39c9135ec27624c6d43923962398965..166fcc8fc2008ed015542a266ac34f36da4ca3cc 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -58,14 +58,20 @@ void MP4StreamParser::Init(const InitCB& init_cb,
end_of_segment_cb_ = end_of_segment_cb;
}
-void MP4StreamParser::Flush() {
- DCHECK_NE(state_, kWaitingForInit);
-
+void MP4StreamParser::Reset() {
queue_.Reset();
+ moov_.reset();
+ runs_.reset();
moof_head_ = 0;
mdat_tail_ = 0;
}
+void MP4StreamParser::Flush() {
+ DCHECK_NE(state_, kWaitingForInit);
+ Reset();
+ ChangeState(kParsingBoxes);
+}
+
bool MP4StreamParser::Parse(const uint8* buf, int size) {
DCHECK_NE(state_, kWaitingForInit);
@@ -97,9 +103,7 @@ bool MP4StreamParser::Parse(const uint8* buf, int size) {
if (err) {
DLOG(ERROR) << "Error while parsing MP4";
- queue_.Reset();
- moov_.reset();
- runs_.reset();
+ Reset();
ChangeState(kError);
return false;
}
@@ -378,8 +382,12 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
std::vector<SubsampleEntry> subsamples;
if (decrypt_config.get())
subsamples = decrypt_config->subsamples();
- RCHECK(PrepareAVCBuffer(runs_->video_description().avcc,
- &frame_buf, &subsamples));
+ if (!PrepareAVCBuffer(runs_->video_description().avcc,
+ &frame_buf, &subsamples)) {
+ DLOG(ERROR) << "Failed to prepare AVC sample for decode";
+ *err = true;
+ return false;
+ }
if (!subsamples.empty()) {
decrypt_config.reset(new DecryptConfig(
decrypt_config->key_id(),
@@ -392,7 +400,11 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
if (audio) {
const AAC& aac = runs_->audio_description().esds.aac;
- RCHECK(aac.ConvertEsdsToADTS(&frame_buf));
+ if (!aac.ConvertEsdsToADTS(&frame_buf)) {
+ DLOG(ERROR) << "Failed to convert ESDS to ADTS";
+ *err = true;
+ return false;
+ }
}
scoped_refptr<StreamParserBuffer> stream_buf =
« no previous file with comments | « media/mp4/mp4_stream_parser.h ('k') | media/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698