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 | 10 |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 853 |
854 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, | 854 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, |
855 const LogCB& log_cb) { | 855 const LogCB& log_cb) { |
856 DCHECK(config.IsValidConfig()); | 856 DCHECK(config.IsValidConfig()); |
857 DCHECK_EQ(type_, AUDIO); | 857 DCHECK_EQ(type_, AUDIO); |
858 base::AutoLock auto_lock(lock_); | 858 base::AutoLock auto_lock(lock_); |
859 if (!stream_) { | 859 if (!stream_) { |
860 DCHECK_EQ(state_, UNINITIALIZED); | 860 DCHECK_EQ(state_, UNINITIALIZED); |
861 | 861 |
862 // On platforms which support splice frames, enable splice frames and | 862 // On platforms which support splice frames, enable splice frames and |
863 // partial append window support for a limited set of codecs. | 863 // partial append window support for most codecs (notably: not opus). |
864 // TODO(dalecurtis): Verify this works for codecs other than MP3 and Vorbis. | 864 const bool codec_supported = config.codec() == kCodecMP3 || |
865 // Right now we want to be extremely conservative to ensure we don't break | 865 config.codec() == kCodecAAC || |
866 // the world. | 866 config.codec() == kCodecVorbis; |
867 const bool mp3_or_vorbis = | 867 splice_frames_enabled_ = splice_frames_enabled_ && codec_supported; |
868 config.codec() == kCodecMP3 || config.codec() == kCodecVorbis; | |
869 splice_frames_enabled_ = splice_frames_enabled_ && mp3_or_vorbis; | |
870 partial_append_window_trimming_enabled_ = | 868 partial_append_window_trimming_enabled_ = |
871 splice_frames_enabled_ && mp3_or_vorbis; | 869 splice_frames_enabled_ && codec_supported; |
872 | 870 |
873 stream_.reset( | 871 stream_.reset( |
874 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); | 872 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); |
875 return true; | 873 return true; |
876 } | 874 } |
877 | 875 |
878 return stream_->UpdateAudioConfig(config); | 876 return stream_->UpdateAudioConfig(config); |
879 } | 877 } |
880 | 878 |
881 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, | 879 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 } | 1735 } |
1738 | 1736 |
1739 void ChunkDemuxer::ShutdownAllStreams() { | 1737 void ChunkDemuxer::ShutdownAllStreams() { |
1740 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1738 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1741 itr != source_state_map_.end(); ++itr) { | 1739 itr != source_state_map_.end(); ++itr) { |
1742 itr->second->Shutdown(); | 1740 itr->second->Shutdown(); |
1743 } | 1741 } |
1744 } | 1742 } |
1745 | 1743 |
1746 } // namespace media | 1744 } // namespace media |
OLD | NEW |