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

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

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 AdtsFrame adts_frame; 122 AdtsFrame adts_frame;
123 while (LookForAdtsFrame(&adts_frame)) { 123 while (LookForAdtsFrame(&adts_frame)) {
124 // Update the audio configuration if needed. 124 // Update the audio configuration if needed.
125 DCHECK_GE(adts_frame.size, kADTSHeaderMinSize); 125 DCHECK_GE(adts_frame.size, kADTSHeaderMinSize);
126 if (!UpdateAudioConfiguration(adts_frame.data)) 126 if (!UpdateAudioConfiguration(adts_frame.data))
127 return false; 127 return false;
128 128
129 // Get the PTS & the duration of this access unit. 129 // Get the PTS & the duration of this access unit.
130 TimingDesc current_timing_desc = 130 TimingDesc current_timing_desc =
131 GetTimingDescriptor(adts_frame.queue_offset); 131 GetTimingDescriptor(adts_frame.queue_offset);
132 if (current_timing_desc.pts != kNoTimestamp()) 132 if (current_timing_desc.pts != kNoTimestamp)
133 audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); 133 audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts);
134 134
135 if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { 135 if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp) {
136 DVLOG(1) << "Skipping audio frame with unknown timestamp"; 136 DVLOG(1) << "Skipping audio frame with unknown timestamp";
137 SkipAdtsFrame(adts_frame); 137 SkipAdtsFrame(adts_frame);
138 continue; 138 continue;
139 } 139 }
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;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 DVLOG(1) << "Channel layout: " 189 DVLOG(1) << "Channel layout: "
190 << ChannelLayoutToString(audio_decoder_config.channel_layout()); 190 << ChannelLayoutToString(audio_decoder_config.channel_layout());
191 191
192 // For AAC audio with SBR (Spectral Band Replication) the sampling rate is 192 // For AAC audio with SBR (Spectral Band Replication) the sampling rate is
193 // doubled in ParseAdtsHeader above, but AudioTimestampHelper should still 193 // doubled in ParseAdtsHeader above, but AudioTimestampHelper should still
194 // use the original sample rate to compute audio timestamps and durations 194 // use the original sample rate to compute audio timestamps and durations
195 // correctly. 195 // correctly.
196 196
197 // Reset the timestamp helper to use a new time scale. 197 // Reset the timestamp helper to use a new time scale.
198 if (audio_timestamp_helper_ && 198 if (audio_timestamp_helper_ &&
199 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) { 199 audio_timestamp_helper_->base_timestamp() != kNoTimestamp) {
200 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp(); 200 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp();
201 audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate)); 201 audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate));
202 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp); 202 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp);
203 } else { 203 } else {
204 audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate)); 204 audio_timestamp_helper_.reset(new AudioTimestampHelper(orig_sample_rate));
205 } 205 }
206 // Audio config notification. 206 // Audio config notification.
207 last_audio_decoder_config_ = audio_decoder_config; 207 last_audio_decoder_config_ = audio_decoder_config;
208 new_audio_config_cb_.Run(audio_decoder_config); 208 new_audio_config_cb_.Run(audio_decoder_config);
209 } 209 }
210 210
211 return true; 211 return true;
212 } 212 }
213 213
214 } // namespace mp2t 214 } // namespace mp2t
215 } // namespace media 215 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698