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

Unified 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: Add unit test and cleanup 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 side-by-side diff with in-line comments
Download patch
Index: media/formats/mp2t/mp2t_stream_parser.cc
diff --git a/media/formats/mp2t/mp2t_stream_parser.cc b/media/formats/mp2t/mp2t_stream_parser.cc
index 35c61d6bde0bf20d6e4caf59a4d47e769ca79a99..a008537748ad38c9b599573905c2f609494651ea 100644
--- a/media/formats/mp2t/mp2t_stream_parser.cc
+++ b/media/formats/mp2t/mp2t_stream_parser.cc
@@ -217,6 +217,9 @@ void Mp2tStreamParser::Flush() {
// Reset the selected PIDs.
selected_audio_pid_ = -1;
selected_video_pid_ = -1;
+
+ // Reset the timestamp unroller.
+ timestamp_unroller_.Reset();
}
bool Mp2tStreamParser::Parse(const uint8* buf, int size) {
@@ -356,7 +359,7 @@ void Mp2tStreamParser::RegisterPes(int pmt_pid,
// Create the PES state here.
DVLOG(1) << "Create a new PES state";
scoped_ptr<TsSection> pes_section_parser(
- new TsSectionPes(es_parser.Pass()));
+ new TsSectionPes(es_parser.Pass(), &timestamp_unroller_));
PidState::PidType pid_type =
is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes;
scoped_ptr<PidState> pes_pid_state(
@@ -519,10 +522,6 @@ void Mp2tStreamParser::OnEmitAudioBuffer(
<< stream_parser_buffer->timestamp().InMilliseconds()
<< " dur="
<< stream_parser_buffer->duration().InMilliseconds();
- stream_parser_buffer->set_timestamp(
- stream_parser_buffer->timestamp() - time_offset_);
- stream_parser_buffer->SetDecodeTimestamp(
- stream_parser_buffer->GetDecodeTimestamp() - time_offset_);
// Ignore the incoming buffer if it is not associated with any config.
if (buffer_queue_chain_.empty()) {
@@ -550,10 +549,6 @@ void Mp2tStreamParser::OnEmitVideoBuffer(
<< stream_parser_buffer->duration().InMilliseconds()
<< " IsKeyframe="
<< stream_parser_buffer->IsKeyframe();
- stream_parser_buffer->set_timestamp(
- stream_parser_buffer->timestamp() - time_offset_);
- stream_parser_buffer->SetDecodeTimestamp(
- stream_parser_buffer->GetDecodeTimestamp() - time_offset_);
// Ignore the incoming buffer if it is not associated with any config.
if (buffer_queue_chain_.empty()) {
@@ -588,6 +583,7 @@ bool Mp2tStreamParser::EmitRemainingBuffers() {
// Buffer emission.
while (!buffer_queue_chain_.empty()) {
+
damienv1 2014/09/15 22:27:36 Remove extra line.
// Start a segment if needed.
if (!segment_started_) {
DVLOG(1) << "Starting a new segment";

Powered by Google App Engine
This is Rietveld 408576698