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

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

Issue 1490613005: media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "media/base/audio_timestamp_helper.h" 12 #include "media/base/audio_timestamp_helper.h"
13 #include "media/base/bit_reader.h" 13 #include "media/base/bit_reader.h"
14 #include "media/base/channel_layout.h" 14 #include "media/base/channel_layout.h"
15 #include "media/base/encryption_scheme.h"
15 #include "media/base/stream_parser_buffer.h" 16 #include "media/base/stream_parser_buffer.h"
16 #include "media/base/timestamp_constants.h" 17 #include "media/base/timestamp_constants.h"
17 #include "media/formats/common/offset_byte_queue.h" 18 #include "media/formats/common/offset_byte_queue.h"
18 #include "media/formats/mp2t/mp2t_common.h" 19 #include "media/formats/mp2t/mp2t_common.h"
19 #include "media/formats/mpeg/adts_constants.h" 20 #include "media/formats/mpeg/adts_constants.h"
20 21
21 namespace media { 22 namespace media {
22 23
23 static int ExtractAdtsFrameSize(const uint8* adts_header) { 24 static int ExtractAdtsFrameSize(const uint8* adts_header) {
24 return ((static_cast<int>(adts_header[5]) >> 5) | 25 return ((static_cast<int>(adts_header[5]) >> 5) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // allows two bits for its value. 219 // allows two bits for its value.
219 ((adts_profile + 1) << 11) + 220 ((adts_profile + 1) << 11) +
220 // frequency_index is [0..13], per early out above. 221 // frequency_index is [0..13], per early out above.
221 (frequency_index << 7) + 222 (frequency_index << 7) +
222 // channel_configuration is [0..7], per early out above. 223 // channel_configuration is [0..7], per early out above.
223 (channel_configuration << 3)); 224 (channel_configuration << 3));
224 std::vector<uint8_t> extra_data; 225 std::vector<uint8_t> extra_data;
225 extra_data.push_back(static_cast<uint8>(extra_data_int >> 8)); 226 extra_data.push_back(static_cast<uint8>(extra_data_int >> 8));
226 extra_data.push_back(static_cast<uint8>(extra_data_int & 0xff)); 227 extra_data.push_back(static_cast<uint8>(extra_data_int & 0xff));
227 228
229 EncryptionScheme scheme(false);
ddorwin 2015/12/10 18:36:01 Why do we need a local variable?
dougsteed 2015/12/14 21:19:02 This is a placeholder for a change in the next CL,
230
228 AudioDecoderConfig audio_decoder_config( 231 AudioDecoderConfig audio_decoder_config(
229 kCodecAAC, 232 kCodecAAC, kSampleFormatS16,
230 kSampleFormatS16,
231 kADTSChannelLayoutTable[channel_configuration], 233 kADTSChannelLayoutTable[channel_configuration],
232 extended_samples_per_second, 234 extended_samples_per_second, extra_data, scheme);
233 extra_data,
234 false);
235 235
236 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) { 236 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) {
237 DVLOG(1) << "Sampling frequency: " << samples_per_second; 237 DVLOG(1) << "Sampling frequency: " << samples_per_second;
238 DVLOG(1) << "Extended sampling frequency: " << extended_samples_per_second; 238 DVLOG(1) << "Extended sampling frequency: " << extended_samples_per_second;
239 DVLOG(1) << "Channel config: " << channel_configuration; 239 DVLOG(1) << "Channel config: " << channel_configuration;
240 DVLOG(1) << "Adts profile: " << adts_profile; 240 DVLOG(1) << "Adts profile: " << adts_profile;
241 // Reset the timestamp helper to use a new time scale. 241 // Reset the timestamp helper to use a new time scale.
242 if (audio_timestamp_helper_ && 242 if (audio_timestamp_helper_ &&
243 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) { 243 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) {
244 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp(); 244 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp();
245 audio_timestamp_helper_.reset( 245 audio_timestamp_helper_.reset(
246 new AudioTimestampHelper(samples_per_second)); 246 new AudioTimestampHelper(samples_per_second));
247 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp); 247 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp);
248 } else { 248 } else {
249 audio_timestamp_helper_.reset( 249 audio_timestamp_helper_.reset(
250 new AudioTimestampHelper(samples_per_second)); 250 new AudioTimestampHelper(samples_per_second));
251 } 251 }
252 // Audio config notification. 252 // Audio config notification.
253 last_audio_decoder_config_ = audio_decoder_config; 253 last_audio_decoder_config_ = audio_decoder_config;
254 new_audio_config_cb_.Run(audio_decoder_config); 254 new_audio_config_cb_.Run(audio_decoder_config);
255 } 255 }
256 256
257 return true; 257 return true;
258 } 258 }
259 259
260 } // namespace mp2t 260 } // namespace mp2t
261 } // namespace media 261 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698