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

Unified Diff: media/mp4/mp4_stream_parser.cc

Issue 20123002: Add Chromium-side support for SourceBuffer.appendWindowStart and SourceBuffer.appendWindowEnd. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and remove URL in comment to make presubmit happy. Created 7 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 56b340a9c6977e770a17daf166bcc0f971b0e525..1d311f40a678e0702270ac51e25f0af0d3d196e5 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -42,8 +42,7 @@ MP4StreamParser::~MP4StreamParser() {}
void MP4StreamParser::Init(const InitCB& init_cb,
const NewConfigCB& config_cb,
- const NewBuffersCB& audio_cb,
- const NewBuffersCB& video_cb,
+ const NewBuffersCB& new_buffers_cb,
const NewTextBuffersCB& /* text_cb */ ,
const NeedKeyCB& need_key_cb,
const AddTextTrackCB& /* add_text_track_cb */ ,
@@ -54,15 +53,14 @@ void MP4StreamParser::Init(const InitCB& init_cb,
DCHECK(init_cb_.is_null());
DCHECK(!init_cb.is_null());
DCHECK(!config_cb.is_null());
- DCHECK(!audio_cb.is_null() || !video_cb.is_null());
+ DCHECK(!new_buffers_cb.is_null());
DCHECK(!need_key_cb.is_null());
DCHECK(!end_of_segment_cb.is_null());
ChangeState(kParsingBoxes);
init_cb_ = init_cb;
config_cb_ = config_cb;
- audio_cb_ = audio_cb;
- video_cb_ = video_cb;
+ new_buffers_cb_ = new_buffers_cb;
need_key_cb_ = need_key_cb;
new_segment_cb_ = new_segment_cb;
end_of_segment_cb_ = end_of_segment_cb;
@@ -324,7 +322,7 @@ bool MP4StreamParser::ParseMoof(BoxReader* reader) {
runs_.reset(new TrackRunIterator(moov_.get(), log_cb_));
RCHECK(runs_->Init(moof));
EmitNeedKeyIfNecessary(moof.pssh);
- new_segment_cb_.Run(runs_->GetMinDecodeTimestamp());
+ new_segment_cb_.Run();
ChangeState(kEmittingSamples);
return true;
}
@@ -534,16 +532,13 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
bool MP4StreamParser::SendAndFlushSamples(BufferQueue* audio_buffers,
BufferQueue* video_buffers) {
- bool err = false;
- if (!audio_buffers->empty()) {
- err |= (audio_cb_.is_null() || !audio_cb_.Run(*audio_buffers));
- audio_buffers->clear();
- }
- if (!video_buffers->empty()) {
- err |= (video_cb_.is_null() || !video_cb_.Run(*video_buffers));
- video_buffers->clear();
- }
- return !err;
+ if (audio_buffers->empty() && video_buffers->empty())
+ return true;
+
+ bool success = new_buffers_cb_.Run(*audio_buffers, *video_buffers);
+ audio_buffers->clear();
+ video_buffers->clear();
+ return success;
}
bool MP4StreamParser::ReadAndDiscardMDATsUntil(const int64 offset) {
« 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