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/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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 base::TimeDelta(), | 214 base::TimeDelta(), |
214 codec_delay_); | 215 codec_delay_); |
215 | 216 |
216 base::TimeDelta base_timestamp; | 217 base::TimeDelta base_timestamp; |
217 if (timestamp_helper_) | 218 if (timestamp_helper_) |
218 base_timestamp = timestamp_helper_->GetTimestamp(); | 219 base_timestamp = timestamp_helper_->GetTimestamp(); |
219 | 220 |
220 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); | 221 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); |
221 timestamp_helper_->SetBaseTimestamp(base_timestamp); | 222 timestamp_helper_->SetBaseTimestamp(base_timestamp); |
222 | 223 |
223 VideoDecoderConfig video_config; | 224 scoped_ptr<MediaTracks> media_tracks(new MediaTracks()); |
224 if (!config_cb_.Run(config_, video_config, TextTrackConfigMap())) | 225 if (config_.IsValidConfig()) { |
wolenetz
2016/02/26 00:06:21
Hmm. Do we instead want to preserve the potential
servolk
2016/02/26 01:56:33
I think it's better to just pass an empty MediaTra
wolenetz
2016/02/26 19:29:27
Ack. If we need more info on why a particular expe
| |
226 media_tracks->AddAudioTrack(config_, "audio", "", "", ""); | |
227 } | |
228 if (!config_cb_.Run(std::move(media_tracks), TextTrackConfigMap())) | |
225 return -1; | 229 return -1; |
226 | 230 |
227 if (!init_cb_.is_null()) { | 231 if (!init_cb_.is_null()) { |
228 InitParameters params(kInfiniteDuration()); | 232 InitParameters params(kInfiniteDuration()); |
229 params.auto_update_timestamp_offset = true; | 233 params.auto_update_timestamp_offset = true; |
230 base::ResetAndReturn(&init_cb_).Run(params); | 234 base::ResetAndReturn(&init_cb_).Run(params); |
231 } | 235 } |
232 } | 236 } |
233 | 237 |
234 if (metadata_frame) | 238 if (metadata_frame) |
(...skipping 177 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 |