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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 } | 823 } |
824 | 824 |
825 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, | 825 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, |
826 const LogCB& log_cb) { | 826 const LogCB& log_cb) { |
827 DCHECK(config.IsValidConfig()); | 827 DCHECK(config.IsValidConfig()); |
828 DCHECK_EQ(type_, AUDIO); | 828 DCHECK_EQ(type_, AUDIO); |
829 base::AutoLock auto_lock(lock_); | 829 base::AutoLock auto_lock(lock_); |
830 if (!stream_) { | 830 if (!stream_) { |
831 DCHECK_EQ(state_, UNINITIALIZED); | 831 DCHECK_EQ(state_, UNINITIALIZED); |
832 | 832 |
833 // Enable partial append window support for a limited set of codecs and only | 833 // On platforms which support splice frames, enable splice frames and |
834 // on platforms that have splice frames enabled. | 834 // partial append window support for a limited set of codecs. |
835 // TODO(dalecurtis): Verify this works for codecs other than MP3 and Vorbis. | 835 // TODO(dalecurtis): Verify this works for codecs other than MP3 and Vorbis. |
836 // Right now we want to be extremely conservative to ensure we don't break | 836 // Right now we want to be extremely conservative to ensure we don't break |
837 // the world. | 837 // the world. |
| 838 const bool mp3_or_vorbis = |
| 839 config.codec() == kCodecMP3 || config.codec() == kCodecVorbis; |
| 840 splice_frames_enabled_ = splice_frames_enabled_ && mp3_or_vorbis; |
838 partial_append_window_trimming_enabled_ = | 841 partial_append_window_trimming_enabled_ = |
839 splice_frames_enabled_ && | 842 splice_frames_enabled_ && mp3_or_vorbis; |
840 (config.codec() == kCodecMP3 || config.codec() == kCodecVorbis); | |
841 | 843 |
842 stream_.reset( | 844 stream_.reset( |
843 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); | 845 new SourceBufferStream(config, log_cb, splice_frames_enabled_)); |
844 return true; | 846 return true; |
845 } | 847 } |
846 | 848 |
847 return stream_->UpdateAudioConfig(config); | 849 return stream_->UpdateAudioConfig(config); |
848 } | 850 } |
849 | 851 |
850 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, | 852 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 } | 1684 } |
1683 | 1685 |
1684 void ChunkDemuxer::ShutdownAllStreams() { | 1686 void ChunkDemuxer::ShutdownAllStreams() { |
1685 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1687 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
1686 itr != source_state_map_.end(); ++itr) { | 1688 itr != source_state_map_.end(); ++itr) { |
1687 itr->second->Shutdown(); | 1689 itr->second->Shutdown(); |
1688 } | 1690 } |
1689 } | 1691 } |
1690 | 1692 |
1691 } // namespace media | 1693 } // namespace media |
OLD | NEW |