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

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

Issue 539343002: Make the timestamp unroll offset consistent accross PES pids. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missing timestamp unroller. Created 6 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
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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // stream parser already involves the end of the current segment. 210 // stream parser already involves the end of the current segment.
211 segment_started_ = false; 211 segment_started_ = false;
212 212
213 // Remove any bytes left in the TS buffer. 213 // Remove any bytes left in the TS buffer.
214 // (i.e. any partial TS packet => less than 188 bytes). 214 // (i.e. any partial TS packet => less than 188 bytes).
215 ts_byte_queue_.Reset(); 215 ts_byte_queue_.Reset();
216 216
217 // Reset the selected PIDs. 217 // Reset the selected PIDs.
218 selected_audio_pid_ = -1; 218 selected_audio_pid_ = -1;
219 selected_video_pid_ = -1; 219 selected_video_pid_ = -1;
220
221 // Reset the timestamp unroller.
222 timestamp_unroller_.Reset();
220 } 223 }
221 224
222 bool Mp2tStreamParser::Parse(const uint8* buf, int size) { 225 bool Mp2tStreamParser::Parse(const uint8* buf, int size) {
223 DVLOG(1) << "Mp2tStreamParser::Parse size=" << size; 226 DVLOG(1) << "Mp2tStreamParser::Parse size=" << size;
224 227
225 // Add the data to the parser state. 228 // Add the data to the parser state.
226 ts_byte_queue_.Push(buf, size); 229 ts_byte_queue_.Push(buf, size);
227 230
228 while (true) { 231 while (true) {
229 const uint8* ts_buffer; 232 const uint8* ts_buffer;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 pes_pid), 352 pes_pid),
350 sbr_in_mimetype_)); 353 sbr_in_mimetype_));
351 is_audio = true; 354 is_audio = true;
352 } else { 355 } else {
353 return; 356 return;
354 } 357 }
355 358
356 // Create the PES state here. 359 // Create the PES state here.
357 DVLOG(1) << "Create a new PES state"; 360 DVLOG(1) << "Create a new PES state";
358 scoped_ptr<TsSection> pes_section_parser( 361 scoped_ptr<TsSection> pes_section_parser(
359 new TsSectionPes(es_parser.Pass())); 362 new TsSectionPes(es_parser.Pass(), &timestamp_unroller_));
360 PidState::PidType pid_type = 363 PidState::PidType pid_type =
361 is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes; 364 is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes;
362 scoped_ptr<PidState> pes_pid_state( 365 scoped_ptr<PidState> pes_pid_state(
363 new PidState(pes_pid, pid_type, pes_section_parser.Pass())); 366 new PidState(pes_pid, pid_type, pes_section_parser.Pass()));
364 pids_.insert(std::pair<int, PidState*>(pes_pid, pes_pid_state.release())); 367 pids_.insert(std::pair<int, PidState*>(pes_pid, pes_pid_state.release()));
365 368
366 // A new PES pid has been added, the PID filter might change. 369 // A new PES pid has been added, the PID filter might change.
367 UpdatePidFilter(); 370 UpdatePidFilter();
368 } 371 }
369 372
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // so that buffers with the same config can be added later on. 626 // so that buffers with the same config can be added later on.
624 BufferQueueWithConfig queue_with_config( 627 BufferQueueWithConfig queue_with_config(
625 true, last_audio_config, last_video_config); 628 true, last_audio_config, last_video_config);
626 buffer_queue_chain_.push_back(queue_with_config); 629 buffer_queue_chain_.push_back(queue_with_config);
627 630
628 return true; 631 return true;
629 } 632 }
630 633
631 } // namespace mp2t 634 } // namespace mp2t
632 } // namespace media 635 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698