| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/filters/source_buffer_state.h" | 5 #include "media/filters/source_buffer_state.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 FrameProcessor::TrackIdChanges track_id_changes; | 548 FrameProcessor::TrackIdChanges track_id_changes; |
| 549 for (const auto& track : tracks->tracks()) { | 549 for (const auto& track : tracks->tracks()) { |
| 550 const auto& track_id = track->bytestream_track_id(); | 550 const auto& track_id = track->bytestream_track_id(); |
| 551 | 551 |
| 552 if (track->type() == MediaTrack::Audio) { | 552 if (track->type() == MediaTrack::Audio) { |
| 553 AudioDecoderConfig audio_config = tracks->getAudioConfig(track_id); | 553 AudioDecoderConfig audio_config = tracks->getAudioConfig(track_id); |
| 554 DVLOG(1) << "Audio track_id=" << track_id | 554 DVLOG(1) << "Audio track_id=" << track_id |
| 555 << " config: " << audio_config.AsHumanReadableString(); | 555 << " config: " << audio_config.AsHumanReadableString(); |
| 556 DCHECK(audio_config.IsValidConfig()); | 556 DCHECK(audio_config.IsValidConfig()); |
| 557 | 557 |
| 558 const auto& it = std::find(expected_acodecs.begin(), | 558 auto it = std::find(expected_acodecs.begin(), expected_acodecs.end(), |
| 559 expected_acodecs.end(), audio_config.codec()); | 559 audio_config.codec()); |
| 560 if (it == expected_acodecs.end()) { | 560 if (it == expected_acodecs.end()) { |
| 561 MEDIA_LOG(ERROR, media_log_) << "Audio stream codec " | 561 MEDIA_LOG(ERROR, media_log_) << "Audio stream codec " |
| 562 << GetCodecName(audio_config.codec()) | 562 << GetCodecName(audio_config.codec()) |
| 563 << " doesn't match SourceBuffer codecs."; | 563 << " doesn't match SourceBuffer codecs."; |
| 564 return false; | 564 // BIG TODO remove HACK |
| 565 if (audio_config.codec() == kCodecMP3) { |
| 566 MEDIA_LOG(INFO, media_log_) << "Hacking mp3 support"; |
| 567 it = expected_acodecs.begin(); // assume only 1.... |
| 568 } else |
| 569 return false; |
| 565 } | 570 } |
| 566 expected_acodecs.erase(it); | 571 expected_acodecs.erase(it); |
| 567 | 572 |
| 568 ChunkDemuxerStream* stream = nullptr; | 573 ChunkDemuxerStream* stream = nullptr; |
| 569 if (!first_init_segment_received_) { | 574 if (!first_init_segment_received_) { |
| 570 DCHECK(audio_streams_.find(track_id) == audio_streams_.end()); | 575 DCHECK(audio_streams_.find(track_id) == audio_streams_.end()); |
| 571 stream = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); | 576 stream = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); |
| 572 if (!stream || !frame_processor_->AddTrack(track_id, stream)) { | 577 if (!stream || !frame_processor_->AddTrack(track_id, stream)) { |
| 573 MEDIA_LOG(ERROR, media_log_) << "Failed to create audio stream."; | 578 MEDIA_LOG(ERROR, media_log_) << "Failed to create audio stream."; |
| 574 return false; | 579 return false; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 } | 893 } |
| 889 void SourceBufferState::OnSourceInitDone( | 894 void SourceBufferState::OnSourceInitDone( |
| 890 const StreamParser::InitParameters& params) { | 895 const StreamParser::InitParameters& params) { |
| 891 DCHECK_EQ(state_, PENDING_PARSER_INIT); | 896 DCHECK_EQ(state_, PENDING_PARSER_INIT); |
| 892 state_ = PARSER_INITIALIZED; | 897 state_ = PARSER_INITIALIZED; |
| 893 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; | 898 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; |
| 894 base::ResetAndReturn(&init_cb_).Run(params); | 899 base::ResetAndReturn(&init_cb_).Run(params); |
| 895 } | 900 } |
| 896 | 901 |
| 897 } // namespace media | 902 } // namespace media |
| OLD | NEW |