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

Side by Side Diff: media/formats/mp2t/mp2t_stream_parser.cc

Issue 1091293005: MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Checkpoint. Not ready for review yet. Created 5 years, 3 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
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.h ('k') | media/formats/mp4/mp4_stream_parser.h » ('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/mp2t/mp2t_stream_parser.h" 5 #include "media/formats/mp2t/mp2t_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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "media/base/stream_parser_buffer.h" 10 #include "media/base/stream_parser_buffer.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Mp2tStreamParser::~Mp2tStreamParser() { 161 Mp2tStreamParser::~Mp2tStreamParser() {
162 STLDeleteValues(&pids_); 162 STLDeleteValues(&pids_);
163 } 163 }
164 164
165 void Mp2tStreamParser::Init( 165 void Mp2tStreamParser::Init(
166 const InitCB& init_cb, 166 const InitCB& init_cb,
167 const NewConfigCB& config_cb, 167 const NewConfigCB& config_cb,
168 const NewBuffersCB& new_buffers_cb, 168 const NewBuffersCB& new_buffers_cb,
169 bool /* ignore_text_tracks */, 169 bool /* ignore_text_tracks */,
170 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 170 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
171 const NewMediaSegmentCB& new_segment_cb, 171 const base::Closure& start_of_segment_cb,
172 const base::Closure& end_of_segment_cb, 172 const base::Closure& end_of_segment_cb,
173 const scoped_refptr<MediaLog>& media_log) { 173 const scoped_refptr<MediaLog>& media_log) {
174 DCHECK(!is_initialized_); 174 DCHECK(!is_initialized_);
175 DCHECK(init_cb_.is_null()); 175 DCHECK(init_cb_.is_null());
176 DCHECK(!init_cb.is_null()); 176 DCHECK(!init_cb.is_null());
177 DCHECK(!config_cb.is_null()); 177 DCHECK(!config_cb.is_null());
178 DCHECK(!new_buffers_cb.is_null()); 178 DCHECK(!new_buffers_cb.is_null());
179 DCHECK(!encrypted_media_init_data_cb.is_null()); 179 DCHECK(!encrypted_media_init_data_cb.is_null());
180 DCHECK(!end_of_segment_cb.is_null()); 180 DCHECK(!end_of_segment_cb.is_null());
181 181
182 init_cb_ = init_cb; 182 init_cb_ = init_cb;
183 config_cb_ = config_cb; 183 config_cb_ = config_cb;
184 new_buffers_cb_ = new_buffers_cb; 184 new_buffers_cb_ = new_buffers_cb;
185 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; 185 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
186 new_segment_cb_ = new_segment_cb; 186 start_of_segment_cb_ = start_of_segment_cb;
187 end_of_segment_cb_ = end_of_segment_cb; 187 end_of_segment_cb_ = end_of_segment_cb;
188 media_log_ = media_log; 188 media_log_ = media_log;
189 } 189 }
190 190
191 void Mp2tStreamParser::Flush() { 191 void Mp2tStreamParser::Flush() {
192 DVLOG(1) << "Mp2tStreamParser::Flush"; 192 DVLOG(1) << "Mp2tStreamParser::Flush";
193 193
194 // Flush the buffers and reset the pids. 194 // Flush the buffers and reset the pids.
195 for (std::map<int, PidState*>::iterator it = pids_.begin(); 195 for (std::map<int, PidState*>::iterator it = pids_.begin();
196 it != pids_.end(); ++it) { 196 it != pids_.end(); ++it) {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 return true; 585 return true;
586 if (selected_video_pid_ >= 0 && !last_video_config.IsValidConfig()) 586 if (selected_video_pid_ >= 0 && !last_video_config.IsValidConfig())
587 return true; 587 return true;
588 588
589 // Buffer emission. 589 // Buffer emission.
590 while (!buffer_queue_chain_.empty()) { 590 while (!buffer_queue_chain_.empty()) {
591 // Start a segment if needed. 591 // Start a segment if needed.
592 if (!segment_started_) { 592 if (!segment_started_) {
593 DVLOG(1) << "Starting a new segment"; 593 DVLOG(1) << "Starting a new segment";
594 segment_started_ = true; 594 segment_started_ = true;
595 new_segment_cb_.Run(); 595 start_of_segment_cb_.Run();
596 } 596 }
597 597
598 // Update the audio and video config if needed. 598 // Update the audio and video config if needed.
599 BufferQueueWithConfig& queue_with_config = buffer_queue_chain_.front(); 599 BufferQueueWithConfig& queue_with_config = buffer_queue_chain_.front();
600 if (!queue_with_config.is_config_sent) { 600 if (!queue_with_config.is_config_sent) {
601 if (!config_cb_.Run(queue_with_config.audio_config, 601 if (!config_cb_.Run(queue_with_config.audio_config,
602 queue_with_config.video_config, 602 queue_with_config.video_config,
603 TextTrackConfigMap())) 603 TextTrackConfigMap()))
604 return false; 604 return false;
605 queue_with_config.is_config_sent = true; 605 queue_with_config.is_config_sent = true;
(...skipping 17 matching lines...) Expand all
623 // so that buffers with the same config can be added later on. 623 // so that buffers with the same config can be added later on.
624 BufferQueueWithConfig queue_with_config( 624 BufferQueueWithConfig queue_with_config(
625 true, last_audio_config, last_video_config); 625 true, last_audio_config, last_video_config);
626 buffer_queue_chain_.push_back(queue_with_config); 626 buffer_queue_chain_.push_back(queue_with_config);
627 627
628 return true; 628 return true;
629 } 629 }
630 630
631 } // namespace mp2t 631 } // namespace mp2t
632 } // namespace media 632 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.h ('k') | media/formats/mp4/mp4_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698