OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <list> | 9 #include <list> |
10 #include <utility> | 10 #include <utility> |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 681 } |
682 | 682 |
683 bool success = true; | 683 bool success = true; |
684 if (audio_config.IsValidConfig()) { | 684 if (audio_config.IsValidConfig()) { |
685 if (!audio_) { | 685 if (!audio_) { |
686 media_log_->SetBooleanProperty("found_audio_stream", true); | 686 media_log_->SetBooleanProperty("found_audio_stream", true); |
687 } | 687 } |
688 if (!audio_ || | 688 if (!audio_ || |
689 audio_->audio_decoder_config().codec() != audio_config.codec()) { | 689 audio_->audio_decoder_config().codec() != audio_config.codec()) { |
690 media_log_->SetStringProperty("audio_codec_name", | 690 media_log_->SetStringProperty("audio_codec_name", |
691 audio_config.GetHumanReadableCodecName()); | 691 GetCodecName(audio_config.codec())); |
692 } | 692 } |
693 | 693 |
694 if (!audio_) { | 694 if (!audio_) { |
695 audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); | 695 audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); |
696 | 696 |
697 if (!audio_) { | 697 if (!audio_) { |
698 DVLOG(1) << "Failed to create an audio stream."; | 698 DVLOG(1) << "Failed to create an audio stream."; |
699 return false; | 699 return false; |
700 } | 700 } |
701 | 701 |
702 if (!frame_processor_->AddTrack(FrameProcessor::kAudioTrackId, audio_)) { | 702 if (!frame_processor_->AddTrack(FrameProcessor::kAudioTrackId, audio_)) { |
703 DVLOG(1) << "Failed to add audio track to frame processor."; | 703 DVLOG(1) << "Failed to add audio track to frame processor."; |
704 return false; | 704 return false; |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 frame_processor_->OnPossibleAudioConfigUpdate(audio_config); | 708 frame_processor_->OnPossibleAudioConfigUpdate(audio_config); |
709 success &= audio_->UpdateAudioConfig(audio_config, media_log_); | 709 success &= audio_->UpdateAudioConfig(audio_config, media_log_); |
710 } | 710 } |
711 | 711 |
712 if (video_config.IsValidConfig()) { | 712 if (video_config.IsValidConfig()) { |
713 if (!video_) { | 713 if (!video_) { |
714 media_log_->SetBooleanProperty("found_video_stream", true); | 714 media_log_->SetBooleanProperty("found_video_stream", true); |
715 } | 715 } |
716 if (!video_ || | 716 if (!video_ || |
717 video_->video_decoder_config().codec() != video_config.codec()) { | 717 video_->video_decoder_config().codec() != video_config.codec()) { |
718 media_log_->SetStringProperty("video_codec_name", | 718 media_log_->SetStringProperty("video_codec_name", |
719 video_config.GetHumanReadableCodecName()); | 719 GetCodecName(video_config.codec())); |
720 } | 720 } |
721 | 721 |
722 if (!video_) { | 722 if (!video_) { |
723 video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO); | 723 video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO); |
724 | 724 |
725 if (!video_) { | 725 if (!video_) { |
726 DVLOG(1) << "Failed to create a video stream."; | 726 DVLOG(1) << "Failed to create a video stream."; |
727 return false; | 727 return false; |
728 } | 728 } |
729 | 729 |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 } | 1967 } |
1968 | 1968 |
1969 void ChunkDemuxer::ShutdownAllStreams() { | 1969 void ChunkDemuxer::ShutdownAllStreams() { |
1970 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1970 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1971 itr != source_state_map_.end(); ++itr) { | 1971 itr != source_state_map_.end(); ++itr) { |
1972 itr->second->Shutdown(); | 1972 itr->second->Shutdown(); |
1973 } | 1973 } |
1974 } | 1974 } |
1975 | 1975 |
1976 } // namespace media | 1976 } // namespace media |
OLD | NEW |