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

Side by Side Diff: media/formats/mp2t/es_parser_adts.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/common/stream_parser_test_base.cc ('k') | media/formats/mp2t/es_parser_h264.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/mp2t/es_parser_adts.h" 5 #include "media/formats/mp2t/es_parser_adts.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); 140 base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp();
141 base::TimeDelta frame_duration = 141 base::TimeDelta frame_duration =
142 audio_timestamp_helper_->GetFrameDuration(kSamplesPerAACFrame); 142 audio_timestamp_helper_->GetFrameDuration(kSamplesPerAACFrame);
143 143
144 // Emit an audio frame. 144 // Emit an audio frame.
145 bool is_key_frame = true; 145 bool is_key_frame = true;
146 146
147 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId 147 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId
148 // type and allow multiple audio tracks. See https://crbug.com/341581. 148 // type and allow multiple audio tracks. See https://crbug.com/341581.
149 scoped_refptr<StreamParserBuffer> stream_parser_buffer = 149 scoped_refptr<StreamParserBuffer> stream_parser_buffer =
150 StreamParserBuffer::CopyFrom( 150 StreamParserBuffer::CopyFrom(adts_frame.data, adts_frame.size,
151 adts_frame.data, 151 is_key_frame, DemuxerStream::AUDIO,
152 adts_frame.size, 152 kMp2tAudioTrackId);
153 is_key_frame,
154 DemuxerStream::AUDIO, 0);
155 stream_parser_buffer->set_timestamp(current_pts); 153 stream_parser_buffer->set_timestamp(current_pts);
156 stream_parser_buffer->SetDecodeTimestamp( 154 stream_parser_buffer->SetDecodeTimestamp(
157 DecodeTimestamp::FromPresentationTime(current_pts)); 155 DecodeTimestamp::FromPresentationTime(current_pts));
158 stream_parser_buffer->set_duration(frame_duration); 156 stream_parser_buffer->set_duration(frame_duration);
159 emit_buffer_cb_.Run(stream_parser_buffer); 157 emit_buffer_cb_.Run(stream_parser_buffer);
160 158
161 // Update the PTS of the next frame. 159 // Update the PTS of the next frame.
162 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame); 160 audio_timestamp_helper_->AddFrames(kSamplesPerAACFrame);
163 161
164 // Skip the current frame. 162 // Skip the current frame.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Audio config notification. 204 // Audio config notification.
207 last_audio_decoder_config_ = audio_decoder_config; 205 last_audio_decoder_config_ = audio_decoder_config;
208 new_audio_config_cb_.Run(audio_decoder_config); 206 new_audio_config_cb_.Run(audio_decoder_config);
209 } 207 }
210 208
211 return true; 209 return true;
212 } 210 }
213 211
214 } // namespace mp2t 212 } // namespace mp2t
215 } // namespace media 213 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/common/stream_parser_test_base.cc ('k') | media/formats/mp2t/es_parser_h264.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698