Chromium Code Reviews| 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..cf022a7e9c4222185f0a9b1712f3c8aadb451f59 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; |
| @@ -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()) |
|
scherkus (not reviewing)
2013/07/24 22:47:41
OOC is there any harm in running the cb w/ empty q
acolwell GONE FROM CHROMIUM
2013/07/25 20:39:33
No. It just violates the contract for the NewBuffe
|
| + 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) { |