Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1554)

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 2698713003: Remove enabled/set_enabled from DemuxerStream interface (Closed)
Patch Set: cast_shell build fix Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 auto itr = source_state_map_.find(id); 688 auto itr = source_state_map_.find(id);
689 689
690 DCHECK(itr != source_state_map_.end()); 690 DCHECK(itr != source_state_map_.end());
691 return itr->second->GetHighestPresentationTimestamp(); 691 return itr->second->GetHighestPresentationTimestamp();
692 } 692 }
693 693
694 void ChunkDemuxer::OnEnabledAudioTracksChanged( 694 void ChunkDemuxer::OnEnabledAudioTracksChanged(
695 const std::vector<MediaTrack::Id>& track_ids, 695 const std::vector<MediaTrack::Id>& track_ids,
696 base::TimeDelta currTime) { 696 base::TimeDelta currTime) {
697 base::AutoLock auto_lock(lock_); 697 base::AutoLock auto_lock(lock_);
698 std::set<DemuxerStream*> enabled_streams; 698 std::set<ChunkDemuxerStream*> enabled_streams;
699 for (const auto& id : track_ids) { 699 for (const auto& id : track_ids) {
700 DemuxerStream* stream = track_id_to_demux_stream_map_[id]; 700 ChunkDemuxerStream* stream = track_id_to_demux_stream_map_[id];
701 DCHECK(stream); 701 DCHECK(stream);
702 DCHECK_EQ(DemuxerStream::AUDIO, stream->type()); 702 DCHECK_EQ(DemuxerStream::AUDIO, stream->type());
703 enabled_streams.insert(stream); 703 enabled_streams.insert(stream);
704 } 704 }
705 705
706 // First disable all streams that need to be disabled and then enable streams 706 // First disable all streams that need to be disabled and then enable streams
707 // that are enabled. 707 // that are enabled.
708 for (const auto& stream : audio_streams_) { 708 for (const auto& stream : audio_streams_) {
709 if (enabled_streams.find(stream.get()) == enabled_streams.end()) { 709 if (enabled_streams.find(stream.get()) == enabled_streams.end()) {
710 DVLOG(1) << __func__ << ": disabling stream " << stream.get(); 710 DVLOG(1) << __func__ << ": disabling stream " << stream.get();
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 const std::vector<MediaTrack::Id>& track_ids,
722 base::TimeDelta currTime) { 722 base::TimeDelta currTime) {
723 DCHECK_LE(track_ids.size(), 1u); 723 DCHECK_LE(track_ids.size(), 1u);
724 724
725 base::AutoLock auto_lock(lock_); 725 base::AutoLock auto_lock(lock_);
726 DemuxerStream* selected_stream = nullptr; 726 ChunkDemuxerStream* selected_stream = nullptr;
727 if (!track_ids.empty()) { 727 if (!track_ids.empty()) {
728 selected_stream = track_id_to_demux_stream_map_[track_ids[0]]; 728 selected_stream = track_id_to_demux_stream_map_[track_ids[0]];
729 DCHECK(selected_stream); 729 DCHECK(selected_stream);
730 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type()); 730 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type());
731 } 731 }
732 732
733 // First disable all streams that need to be disabled and then enable the 733 // First disable all streams that need to be disabled and then enable the
734 // stream that needs to be enabled (if any). 734 // stream that needs to be enabled (if any).
735 for (const auto& stream : video_streams_) { 735 for (const auto& stream : video_streams_) {
736 if (stream.get() != selected_stream) { 736 if (stream.get() != selected_stream) {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 } 1329 }
1330 1330
1331 void ChunkDemuxer::ShutdownAllStreams() { 1331 void ChunkDemuxer::ShutdownAllStreams() {
1332 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); 1332 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end();
1333 ++itr) { 1333 ++itr) {
1334 itr->second->Shutdown(); 1334 itr->second->Shutdown();
1335 } 1335 }
1336 } 1336 }
1337 1337
1338 } // namespace media 1338 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698