| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 stream->set_enabled(false, currTime); | 711 stream->set_enabled(false, currTime); |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 for (const auto& stream : enabled_streams) { | 714 for (const auto& stream : enabled_streams) { |
| 715 DVLOG(1) << __func__ << ": enabling stream " << stream; | 715 DVLOG(1) << __func__ << ": enabling stream " << stream; |
| 716 stream->set_enabled(true, currTime); | 716 stream->set_enabled(true, currTime); |
| 717 } | 717 } |
| 718 } | 718 } |
| 719 | 719 |
| 720 void ChunkDemuxer::OnSelectedVideoTrackChanged( | 720 void ChunkDemuxer::OnSelectedVideoTrackChanged( |
| 721 const std::vector<MediaTrack::Id>& track_ids, | 721 base::Optional<MediaTrack::Id> track_id, |
| 722 base::TimeDelta currTime) { | 722 base::TimeDelta currTime) { |
| 723 DCHECK_LE(track_ids.size(), 1u); | |
| 724 | |
| 725 base::AutoLock auto_lock(lock_); | 723 base::AutoLock auto_lock(lock_); |
| 726 ChunkDemuxerStream* selected_stream = nullptr; | 724 ChunkDemuxerStream* selected_stream = nullptr; |
| 727 if (!track_ids.empty()) { | 725 if (track_id) { |
| 728 selected_stream = track_id_to_demux_stream_map_[track_ids[0]]; | 726 selected_stream = track_id_to_demux_stream_map_[*track_id]; |
| 729 DCHECK(selected_stream); | 727 DCHECK(selected_stream); |
| 730 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type()); | 728 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type()); |
| 731 } | 729 } |
| 732 | 730 |
| 733 // First disable all streams that need to be disabled and then enable the | 731 // First disable all streams that need to be disabled and then enable the |
| 734 // stream that needs to be enabled (if any). | 732 // stream that needs to be enabled (if any). |
| 735 for (const auto& stream : video_streams_) { | 733 for (const auto& stream : video_streams_) { |
| 736 if (stream.get() != selected_stream) { | 734 if (stream.get() != selected_stream) { |
| 737 DVLOG(1) << __func__ << ": disabling stream " << stream.get(); | 735 DVLOG(1) << __func__ << ": disabling stream " << stream.get(); |
| 738 DCHECK_EQ(DemuxerStream::VIDEO, stream->type()); | 736 DCHECK_EQ(DemuxerStream::VIDEO, stream->type()); |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 } | 1327 } |
| 1330 | 1328 |
| 1331 void ChunkDemuxer::ShutdownAllStreams() { | 1329 void ChunkDemuxer::ShutdownAllStreams() { |
| 1332 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); | 1330 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); |
| 1333 ++itr) { | 1331 ++itr) { |
| 1334 itr->second->Shutdown(); | 1332 itr->second->Shutdown(); |
| 1335 } | 1333 } |
| 1336 } | 1334 } |
| 1337 | 1335 |
| 1338 } // namespace media | 1336 } // namespace media |
| OLD | NEW |