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

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

Issue 1490613005: media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed a couple comments Created 4 years, 9 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_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"
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/media_util.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/mpeg1_audio_stream_parser.h" 20 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h"
20 21
21 namespace media { 22 namespace media {
22 namespace mp2t { 23 namespace mp2t {
23 24
24 struct EsParserMpeg1Audio::Mpeg1AudioFrame { 25 struct EsParserMpeg1Audio::Mpeg1AudioFrame {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const uint8_t* mpeg1audio_header) { 164 const uint8_t* mpeg1audio_header) {
164 MPEG1AudioStreamParser::Header header; 165 MPEG1AudioStreamParser::Header header;
165 if (!MPEG1AudioStreamParser::ParseHeader(media_log_, mpeg1audio_header, 166 if (!MPEG1AudioStreamParser::ParseHeader(media_log_, mpeg1audio_header,
166 &header)) { 167 &header)) {
167 return false; 168 return false;
168 } 169 }
169 170
170 // TODO(damienv): Verify whether Android playback requires the extra data 171 // TODO(damienv): Verify whether Android playback requires the extra data
171 // field for Mpeg1 audio. If yes, we should generate this field. 172 // field for Mpeg1 audio. If yes, we should generate this field.
172 AudioDecoderConfig audio_decoder_config( 173 AudioDecoderConfig audio_decoder_config(
173 kCodecMP3, 174 kCodecMP3, kSampleFormatS16, header.channel_layout, header.sample_rate,
174 kSampleFormatS16, 175 std::vector<uint8_t>(), Unencrypted());
xhwang 2016/03/04 20:00:48 nti: EmptyExtraData(), thanks!
dougsteed 2016/03/07 17:49:13 Done.
175 header.channel_layout,
176 header.sample_rate,
177 std::vector<uint8_t>(),
178 false);
179 176
180 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) { 177 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) {
181 DVLOG(1) << "Sampling frequency: " << header.sample_rate; 178 DVLOG(1) << "Sampling frequency: " << header.sample_rate;
182 DVLOG(1) << "Channel layout: " << header.channel_layout; 179 DVLOG(1) << "Channel layout: " << header.channel_layout;
183 // Reset the timestamp helper to use a new time scale. 180 // Reset the timestamp helper to use a new time scale.
184 if (audio_timestamp_helper_ && 181 if (audio_timestamp_helper_ &&
185 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) { 182 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) {
186 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp(); 183 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp();
187 audio_timestamp_helper_.reset( 184 audio_timestamp_helper_.reset(
188 new AudioTimestampHelper(header.sample_rate)); 185 new AudioTimestampHelper(header.sample_rate));
(...skipping 11 matching lines...) Expand all
200 } 197 }
201 198
202 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( 199 void EsParserMpeg1Audio::SkipMpeg1AudioFrame(
203 const Mpeg1AudioFrame& mpeg1audio_frame) { 200 const Mpeg1AudioFrame& mpeg1audio_frame) {
204 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); 201 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head());
205 es_queue_->Pop(mpeg1audio_frame.size); 202 es_queue_->Pop(mpeg1audio_frame.size);
206 } 203 }
207 204
208 } // namespace mp2t 205 } // namespace mp2t
209 } // namespace media 206 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698