| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 837 |
| 838 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, | 838 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, |
| 839 const LogCB& log_cb) { | 839 const LogCB& log_cb) { |
| 840 DCHECK(config.IsValidConfig()); | 840 DCHECK(config.IsValidConfig()); |
| 841 DCHECK_EQ(type_, AUDIO); | 841 DCHECK_EQ(type_, AUDIO); |
| 842 base::AutoLock auto_lock(lock_); | 842 base::AutoLock auto_lock(lock_); |
| 843 if (!stream_) { | 843 if (!stream_) { |
| 844 DCHECK_EQ(state_, UNINITIALIZED); | 844 DCHECK_EQ(state_, UNINITIALIZED); |
| 845 | 845 |
| 846 // On platforms which support splice frames, enable splice frames and | 846 // On platforms which support splice frames, enable splice frames and |
| 847 // partial append window support for a limited set of codecs. | 847 // partial append window support for most codecs (notably: not opus). |
| 848 // TODO(dalecurtis): Verify this works for codecs other than MP3 and Vorbis. | 848 const bool codec_supported = config.codec() == kCodecMP3 || |
| 849 // Right now we want to be extremely conservative to ensure we don't break | 849 config.codec() == kCodecAAC || |
| 850 // the world. | 850 config.codec() == kCodecVorbis; |
| 851 const bool mp3_or_vorbis = | 851 splice_frames_enabled_ = splice_frames_enabled_ && codec_supported; |
| 852 config.codec() == kCodecMP3 || config.codec() == kCodecVorbis; | |
| 853 splice_frames_enabled_ = splice_frames_enabled_ && mp3_or_vorbis; | |
| 854 partial_append_window_trimming_enabled_ = | 852 partial_append_window_trimming_enabled_ = |
| 855 splice_frames_enabled_ && mp3_or_vorbis; | 853 splice_frames_enabled_ && codec_supported; |
| 856 | 854 |
| 857 stream_.reset( | 855 stream_.reset( |
| 858 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); | 856 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); |
| 859 return true; | 857 return true; |
| 860 } | 858 } |
| 861 | 859 |
| 862 return stream_->UpdateAudioConfig(config); | 860 return stream_->UpdateAudioConfig(config); |
| 863 } | 861 } |
| 864 | 862 |
| 865 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, | 863 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 } | 1700 } |
| 1703 | 1701 |
| 1704 void ChunkDemuxer::ShutdownAllStreams() { | 1702 void ChunkDemuxer::ShutdownAllStreams() { |
| 1705 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1703 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
| 1706 itr != source_state_map_.end(); ++itr) { | 1704 itr != source_state_map_.end(); ++itr) { |
| 1707 itr->second->Shutdown(); | 1705 itr->second->Shutdown(); |
| 1708 } | 1706 } |
| 1709 } | 1707 } |
| 1710 | 1708 |
| 1711 } // namespace media | 1709 } // namespace media |
| OLD | NEW |