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

Side by Side Diff: media/formats/mp3/mp3_stream_parser.cc

Issue 143973009: SourceState: Coalesce OnNewBuffers() CB to include OnTextBuffers() behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address PS2 comments Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/formats/mp3/mp3_stream_parser.h ('k') | media/formats/mp3/mp3_stream_parser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/mp3/mp3_stream_parser.h" 5 #include "media/formats/mp3/mp3_stream_parser.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/bit_reader.h" 10 #include "media/base/bit_reader.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 MP3StreamParser::MP3StreamParser() 110 MP3StreamParser::MP3StreamParser()
111 : state_(UNINITIALIZED), 111 : state_(UNINITIALIZED),
112 in_media_segment_(false) { 112 in_media_segment_(false) {
113 } 113 }
114 114
115 MP3StreamParser::~MP3StreamParser() {} 115 MP3StreamParser::~MP3StreamParser() {}
116 116
117 void MP3StreamParser::Init(const InitCB& init_cb, 117 void MP3StreamParser::Init(const InitCB& init_cb,
118 const NewConfigCB& config_cb, 118 const NewConfigCB& config_cb,
119 const NewBuffersCB& new_buffers_cb, 119 const NewBuffersCB& new_buffers_cb,
120 const NewTextBuffersCB& text_cb, 120 bool ignore_text_tracks,
121 const NeedKeyCB& need_key_cb, 121 const NeedKeyCB& need_key_cb,
122 const NewMediaSegmentCB& new_segment_cb, 122 const NewMediaSegmentCB& new_segment_cb,
123 const base::Closure& end_of_segment_cb, 123 const base::Closure& end_of_segment_cb,
124 const LogCB& log_cb) { 124 const LogCB& log_cb) {
125 DVLOG(1) << __FUNCTION__; 125 DVLOG(1) << __FUNCTION__;
126 DCHECK_EQ(state_, UNINITIALIZED); 126 DCHECK_EQ(state_, UNINITIALIZED);
127 init_cb_ = init_cb; 127 init_cb_ = init_cb;
128 config_cb_ = config_cb; 128 config_cb_ = config_cb;
129 new_buffers_cb_ = new_buffers_cb; 129 new_buffers_cb_ = new_buffers_cb;
130 new_segment_cb_ = new_segment_cb; 130 new_segment_cb_ = new_segment_cb;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 591
592 bool MP3StreamParser::SendBuffers(BufferQueue* buffers, bool end_of_segment) { 592 bool MP3StreamParser::SendBuffers(BufferQueue* buffers, bool end_of_segment) {
593 DCHECK(!buffers->empty()); 593 DCHECK(!buffers->empty());
594 594
595 if (!in_media_segment_) { 595 if (!in_media_segment_) {
596 in_media_segment_ = true; 596 in_media_segment_ = true;
597 new_segment_cb_.Run(); 597 new_segment_cb_.Run();
598 } 598 }
599 599
600 BufferQueue empty_video_buffers; 600 BufferQueue empty_video_buffers;
601 if (!new_buffers_cb_.Run(*buffers, empty_video_buffers)) 601 TextBufferQueueMap empty_text_map;
602 if (!new_buffers_cb_.Run(*buffers, empty_video_buffers, empty_text_map))
602 return false; 603 return false;
603 buffers->clear(); 604 buffers->clear();
604 605
605 if (end_of_segment) { 606 if (end_of_segment) {
606 in_media_segment_ = false; 607 in_media_segment_ = false;
607 end_of_segment_cb_.Run(); 608 end_of_segment_cb_.Run();
608 } 609 }
609 610
610 return true; 611 return true;
611 } 612 }
612 613
613 } // namespace media 614 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp3/mp3_stream_parser.h ('k') | media/formats/mp3/mp3_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698