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_t kICYStartCode = 0x49435920; // 'ICY ' | 18 static const uint32_t 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 config_.channel_layout() != channel_layout)) { | 198 config_.channel_layout() != channel_layout)) { |
198 // Clear config data so that a config change is initiated. | 199 // Clear config data so that a config change is initiated. |
199 config_ = AudioDecoderConfig(); | 200 config_ = AudioDecoderConfig(); |
200 | 201 |
201 // Send all buffers associated with the previous config. | 202 // Send all buffers associated with the previous config. |
202 if (!buffers->empty() && !SendBuffers(buffers, true)) | 203 if (!buffers->empty() && !SendBuffers(buffers, true)) |
203 return -1; | 204 return -1; |
204 } | 205 } |
205 | 206 |
206 if (!config_.IsValidConfig()) { | 207 if (!config_.IsValidConfig()) { |
207 config_.Initialize(audio_codec_, | 208 config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout, |
208 kSampleFormatF32, | 209 sample_rate, std::vector<uint8_t>(), |
209 channel_layout, | 210 EncryptionScheme::Unencrypted(), base::TimeDelta(), |
210 sample_rate, | |
211 std::vector<uint8_t>(), | |
212 false, | |
213 base::TimeDelta(), | |
214 codec_delay_); | 211 codec_delay_); |
215 | 212 |
216 base::TimeDelta base_timestamp; | 213 base::TimeDelta base_timestamp; |
217 if (timestamp_helper_) | 214 if (timestamp_helper_) |
218 base_timestamp = timestamp_helper_->GetTimestamp(); | 215 base_timestamp = timestamp_helper_->GetTimestamp(); |
219 | 216 |
220 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); | 217 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); |
221 timestamp_helper_->SetBaseTimestamp(base_timestamp); | 218 timestamp_helper_->SetBaseTimestamp(base_timestamp); |
222 | 219 |
223 VideoDecoderConfig video_config; | 220 VideoDecoderConfig video_config; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (end_of_segment) { | 409 if (end_of_segment) { |
413 in_media_segment_ = false; | 410 in_media_segment_ = false; |
414 end_of_segment_cb_.Run(); | 411 end_of_segment_cb_.Run(); |
415 } | 412 } |
416 | 413 |
417 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 414 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
418 return true; | 415 return true; |
419 } | 416 } |
420 | 417 |
421 } // namespace media | 418 } // namespace media |
OLD | NEW |