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

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

Issue 2239013002: Assign correct track ids to buffers emitted from StreamParsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/es_parser_h264.cc ('k') | media/formats/mp2t/mp2t_common.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/es_parser_mpeg1audio.h" 5 #include "media/formats/mp2t/es_parser_mpeg1audio.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 base::TimeDelta frame_duration = 72 base::TimeDelta frame_duration =
73 audio_timestamp_helper_->GetFrameDuration( 73 audio_timestamp_helper_->GetFrameDuration(
74 mpeg1audio_frame.sample_count); 74 mpeg1audio_frame.sample_count);
75 75
76 // Emit an audio frame. 76 // Emit an audio frame.
77 bool is_key_frame = true; 77 bool is_key_frame = true;
78 78
79 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId 79 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId
80 // type and allow multiple audio tracks. See https://crbug.com/341581. 80 // type and allow multiple audio tracks. See https://crbug.com/341581.
81 scoped_refptr<StreamParserBuffer> stream_parser_buffer = 81 scoped_refptr<StreamParserBuffer> stream_parser_buffer =
82 StreamParserBuffer::CopyFrom( 82 StreamParserBuffer::CopyFrom(mpeg1audio_frame.data,
83 mpeg1audio_frame.data, 83 mpeg1audio_frame.size, is_key_frame,
84 mpeg1audio_frame.size, 84 DemuxerStream::AUDIO, kMp2tAudioTrackId);
85 is_key_frame,
86 DemuxerStream::AUDIO, 0);
87 stream_parser_buffer->set_timestamp(current_pts); 85 stream_parser_buffer->set_timestamp(current_pts);
88 stream_parser_buffer->set_duration(frame_duration); 86 stream_parser_buffer->set_duration(frame_duration);
89 emit_buffer_cb_.Run(stream_parser_buffer); 87 emit_buffer_cb_.Run(stream_parser_buffer);
90 88
91 // Update the PTS of the next frame. 89 // Update the PTS of the next frame.
92 audio_timestamp_helper_->AddFrames(mpeg1audio_frame.sample_count); 90 audio_timestamp_helper_->AddFrames(mpeg1audio_frame.sample_count);
93 91
94 // Skip the current frame. 92 // Skip the current frame.
95 SkipMpeg1AudioFrame(mpeg1audio_frame); 93 SkipMpeg1AudioFrame(mpeg1audio_frame);
96 } 94 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 195 }
198 196
199 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( 197 void EsParserMpeg1Audio::SkipMpeg1AudioFrame(
200 const Mpeg1AudioFrame& mpeg1audio_frame) { 198 const Mpeg1AudioFrame& mpeg1audio_frame) {
201 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); 199 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head());
202 es_queue_->Pop(mpeg1audio_frame.size); 200 es_queue_->Pop(mpeg1audio_frame.size);
203 } 201 }
204 202
205 } // namespace mp2t 203 } // namespace mp2t
206 } // namespace media 204 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/es_parser_h264.cc ('k') | media/formats/mp2t/mp2t_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698