OLD | NEW |
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/mpeg/mpeg_audio_stream_parser_base.h" | 5 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "media/base/encryption_scheme.h" |
10 #include "media/base/stream_parser_buffer.h" | 11 #include "media/base/stream_parser_buffer.h" |
11 #include "media/base/text_track_config.h" | 12 #include "media/base/text_track_config.h" |
12 #include "media/base/timestamp_constants.h" | 13 #include "media/base/timestamp_constants.h" |
13 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
17 static const uint32 kICYStartCode = 0x49435920; // 'ICY ' | 18 static const uint32 kICYStartCode = 0x49435920; // 'ICY ' |
18 | 19 |
19 // Arbitrary upper bound on the size of an IceCast header before it | 20 // Arbitrary upper bound on the size of an IceCast header before it |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 config_.channel_layout() != channel_layout)) { | 197 config_.channel_layout() != channel_layout)) { |
197 // Clear config data so that a config change is initiated. | 198 // Clear config data so that a config change is initiated. |
198 config_ = AudioDecoderConfig(); | 199 config_ = AudioDecoderConfig(); |
199 | 200 |
200 // Send all buffers associated with the previous config. | 201 // Send all buffers associated with the previous config. |
201 if (!buffers->empty() && !SendBuffers(buffers, true)) | 202 if (!buffers->empty() && !SendBuffers(buffers, true)) |
202 return -1; | 203 return -1; |
203 } | 204 } |
204 | 205 |
205 if (!config_.IsValidConfig()) { | 206 if (!config_.IsValidConfig()) { |
206 config_.Initialize(audio_codec_, | 207 config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout, |
207 kSampleFormatF32, | 208 sample_rate, std::vector<uint8_t>(), |
208 channel_layout, | 209 EncryptionScheme(false), base::TimeDelta(), |
209 sample_rate, | |
210 std::vector<uint8_t>(), | |
211 false, | |
212 base::TimeDelta(), | |
213 codec_delay_); | 210 codec_delay_); |
214 | 211 |
215 base::TimeDelta base_timestamp; | 212 base::TimeDelta base_timestamp; |
216 if (timestamp_helper_) | 213 if (timestamp_helper_) |
217 base_timestamp = timestamp_helper_->GetTimestamp(); | 214 base_timestamp = timestamp_helper_->GetTimestamp(); |
218 | 215 |
219 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); | 216 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); |
220 timestamp_helper_->SetBaseTimestamp(base_timestamp); | 217 timestamp_helper_->SetBaseTimestamp(base_timestamp); |
221 | 218 |
222 VideoDecoderConfig video_config; | 219 VideoDecoderConfig video_config; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 if (end_of_segment) { | 407 if (end_of_segment) { |
411 in_media_segment_ = false; | 408 in_media_segment_ = false; |
412 end_of_segment_cb_.Run(); | 409 end_of_segment_cb_.Run(); |
413 } | 410 } |
414 | 411 |
415 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 412 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
416 return true; | 413 return true; |
417 } | 414 } |
418 | 415 |
419 } // namespace media | 416 } // namespace media |
OLD | NEW |