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

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

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « media/formats/mp2t/es_parser_h264.cc ('k') | media/formats/mp4/mp4_stream_parser.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_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"
16 #include "media/base/stream_parser_buffer.h" 15 #include "media/base/stream_parser_buffer.h"
17 #include "media/base/timestamp_constants.h" 16 #include "media/base/timestamp_constants.h"
18 #include "media/formats/common/offset_byte_queue.h" 17 #include "media/formats/common/offset_byte_queue.h"
19 #include "media/formats/mp2t/mp2t_common.h" 18 #include "media/formats/mp2t/mp2t_common.h"
20 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" 19 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h"
21 20
22 namespace media { 21 namespace media {
23 namespace mp2t { 22 namespace mp2t {
24 23
25 struct EsParserMpeg1Audio::Mpeg1AudioFrame { 24 struct EsParserMpeg1Audio::Mpeg1AudioFrame {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const uint8_t* mpeg1audio_header) { 163 const uint8_t* mpeg1audio_header) {
165 MPEG1AudioStreamParser::Header header; 164 MPEG1AudioStreamParser::Header header;
166 if (!MPEG1AudioStreamParser::ParseHeader(media_log_, mpeg1audio_header, 165 if (!MPEG1AudioStreamParser::ParseHeader(media_log_, mpeg1audio_header,
167 &header)) { 166 &header)) {
168 return false; 167 return false;
169 } 168 }
170 169
171 // TODO(damienv): Verify whether Android playback requires the extra data 170 // TODO(damienv): Verify whether Android playback requires the extra data
172 // field for Mpeg1 audio. If yes, we should generate this field. 171 // field for Mpeg1 audio. If yes, we should generate this field.
173 AudioDecoderConfig audio_decoder_config( 172 AudioDecoderConfig audio_decoder_config(
174 kCodecMP3, kSampleFormatS16, header.channel_layout, header.sample_rate, 173 kCodecMP3,
175 EmptyExtraData(), Unencrypted()); 174 kSampleFormatS16,
175 header.channel_layout,
176 header.sample_rate,
177 std::vector<uint8_t>(),
178 false);
176 179
177 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) { 180 if (!audio_decoder_config.Matches(last_audio_decoder_config_)) {
178 DVLOG(1) << "Sampling frequency: " << header.sample_rate; 181 DVLOG(1) << "Sampling frequency: " << header.sample_rate;
179 DVLOG(1) << "Channel layout: " << header.channel_layout; 182 DVLOG(1) << "Channel layout: " << header.channel_layout;
180 // Reset the timestamp helper to use a new time scale. 183 // Reset the timestamp helper to use a new time scale.
181 if (audio_timestamp_helper_ && 184 if (audio_timestamp_helper_ &&
182 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) { 185 audio_timestamp_helper_->base_timestamp() != kNoTimestamp()) {
183 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp(); 186 base::TimeDelta base_timestamp = audio_timestamp_helper_->GetTimestamp();
184 audio_timestamp_helper_.reset( 187 audio_timestamp_helper_.reset(
185 new AudioTimestampHelper(header.sample_rate)); 188 new AudioTimestampHelper(header.sample_rate));
(...skipping 11 matching lines...) Expand all
197 } 200 }
198 201
199 void EsParserMpeg1Audio::SkipMpeg1AudioFrame( 202 void EsParserMpeg1Audio::SkipMpeg1AudioFrame(
200 const Mpeg1AudioFrame& mpeg1audio_frame) { 203 const Mpeg1AudioFrame& mpeg1audio_frame) {
201 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head()); 204 DCHECK_EQ(mpeg1audio_frame.queue_offset, es_queue_->head());
202 es_queue_->Pop(mpeg1audio_frame.size); 205 es_queue_->Pop(mpeg1audio_frame.size);
203 } 206 }
204 207
205 } // namespace mp2t 208 } // namespace mp2t
206 } // namespace media 209 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/es_parser_h264.cc ('k') | media/formats/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698