| 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/media_tracks.h" | 10 #include "media/base/media_tracks.h" |
| 11 #include "media/base/media_util.h" | |
| 12 #include "media/base/stream_parser_buffer.h" | 11 #include "media/base/stream_parser_buffer.h" |
| 13 #include "media/base/text_track_config.h" | 12 #include "media/base/text_track_config.h" |
| 14 #include "media/base/timestamp_constants.h" | 13 #include "media/base/timestamp_constants.h" |
| 15 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
| 16 | 15 |
| 17 namespace media { | 16 namespace media { |
| 18 | 17 |
| 19 static const uint32_t kICYStartCode = 0x49435920; // 'ICY ' | 18 static const uint32_t kICYStartCode = 0x49435920; // 'ICY ' |
| 20 | 19 |
| 21 // 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... |
| 199 config_.channel_layout() != channel_layout)) { | 198 config_.channel_layout() != channel_layout)) { |
| 200 // Clear config data so that a config change is initiated. | 199 // Clear config data so that a config change is initiated. |
| 201 config_ = AudioDecoderConfig(); | 200 config_ = AudioDecoderConfig(); |
| 202 | 201 |
| 203 // Send all buffers associated with the previous config. | 202 // Send all buffers associated with the previous config. |
| 204 if (!buffers->empty() && !SendBuffers(buffers, true)) | 203 if (!buffers->empty() && !SendBuffers(buffers, true)) |
| 205 return -1; | 204 return -1; |
| 206 } | 205 } |
| 207 | 206 |
| 208 if (!config_.IsValidConfig()) { | 207 if (!config_.IsValidConfig()) { |
| 209 config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout, | 208 config_.Initialize(audio_codec_, |
| 210 sample_rate, std::vector<uint8_t>(), Unencrypted(), | 209 kSampleFormatF32, |
| 211 base::TimeDelta(), codec_delay_); | 210 channel_layout, |
| 211 sample_rate, |
| 212 std::vector<uint8_t>(), |
| 213 false, |
| 214 base::TimeDelta(), |
| 215 codec_delay_); |
| 212 | 216 |
| 213 base::TimeDelta base_timestamp; | 217 base::TimeDelta base_timestamp; |
| 214 if (timestamp_helper_) | 218 if (timestamp_helper_) |
| 215 base_timestamp = timestamp_helper_->GetTimestamp(); | 219 base_timestamp = timestamp_helper_->GetTimestamp(); |
| 216 | 220 |
| 217 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); | 221 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); |
| 218 timestamp_helper_->SetBaseTimestamp(base_timestamp); | 222 timestamp_helper_->SetBaseTimestamp(base_timestamp); |
| 219 | 223 |
| 220 scoped_ptr<MediaTracks> media_tracks(new MediaTracks()); | 224 scoped_ptr<MediaTracks> media_tracks(new MediaTracks()); |
| 221 if (config_.IsValidConfig()) { | 225 if (config_.IsValidConfig()) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 if (end_of_segment) { | 416 if (end_of_segment) { |
| 413 in_media_segment_ = false; | 417 in_media_segment_ = false; |
| 414 end_of_segment_cb_.Run(); | 418 end_of_segment_cb_.Run(); |
| 415 } | 419 } |
| 416 | 420 |
| 417 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 421 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
| 418 return true; | 422 return true; |
| 419 } | 423 } |
| 420 | 424 |
| 421 } // namespace media | 425 } // namespace media |
| OLD | NEW |