| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "media/base/media_log.h" |
| 12 #include "media/base/media_tracks.h" | 13 #include "media/base/media_tracks.h" |
| 13 #include "media/base/media_util.h" | 14 #include "media/base/media_util.h" |
| 14 #include "media/base/stream_parser_buffer.h" | 15 #include "media/base/stream_parser_buffer.h" |
| 15 #include "media/base/text_track_config.h" | 16 #include "media/base/text_track_config.h" |
| 16 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 17 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 static const uint32_t kICYStartCode = 0x49435920; // 'ICY ' | 22 static const uint32_t kICYStartCode = 0x49435920; // 'ICY ' |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 215 |
| 215 base::TimeDelta base_timestamp; | 216 base::TimeDelta base_timestamp; |
| 216 if (timestamp_helper_) | 217 if (timestamp_helper_) |
| 217 base_timestamp = timestamp_helper_->GetTimestamp(); | 218 base_timestamp = timestamp_helper_->GetTimestamp(); |
| 218 | 219 |
| 219 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); | 220 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); |
| 220 timestamp_helper_->SetBaseTimestamp(base_timestamp); | 221 timestamp_helper_->SetBaseTimestamp(base_timestamp); |
| 221 | 222 |
| 222 std::unique_ptr<MediaTracks> media_tracks(new MediaTracks()); | 223 std::unique_ptr<MediaTracks> media_tracks(new MediaTracks()); |
| 223 if (config_.IsValidConfig()) { | 224 if (config_.IsValidConfig()) { |
| 224 media_tracks->AddAudioTrack(config_, "audio", "", "", ""); | 225 media_tracks->AddAudioTrack(config_, 1, "main", "", ""); |
| 225 } | 226 } |
| 226 if (!config_cb_.Run(std::move(media_tracks), TextTrackConfigMap())) | 227 if (!config_cb_.Run(std::move(media_tracks), TextTrackConfigMap())) |
| 227 return -1; | 228 return -1; |
| 228 | 229 |
| 229 if (!init_cb_.is_null()) { | 230 if (!init_cb_.is_null()) { |
| 230 InitParameters params(kInfiniteDuration()); | 231 InitParameters params(kInfiniteDuration()); |
| 231 params.detected_audio_track_count = 1; | 232 params.detected_audio_track_count = 1; |
| 232 params.auto_update_timestamp_offset = true; | 233 params.auto_update_timestamp_offset = true; |
| 233 base::ResetAndReturn(&init_cb_).Run(params); | 234 base::ResetAndReturn(&init_cb_).Run(params); |
| 234 } | 235 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 if (end_of_segment) { | 416 if (end_of_segment) { |
| 416 in_media_segment_ = false; | 417 in_media_segment_ = false; |
| 417 end_of_segment_cb_.Run(); | 418 end_of_segment_cb_.Run(); |
| 418 } | 419 } |
| 419 | 420 |
| 420 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 421 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
| 421 return true; | 422 return true; |
| 422 } | 423 } |
| 423 | 424 |
| 424 } // namespace media | 425 } // namespace media |
| OLD | NEW |