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

Side by Side Diff: media/filters/ffmpeg_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/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_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/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1623
1624 // Notify we're finished seeking. 1624 // Notify we're finished seeking.
1625 base::ResetAndReturn(&pending_seek_cb_).Run(PIPELINE_OK); 1625 base::ResetAndReturn(&pending_seek_cb_).Run(PIPELINE_OK);
1626 } 1626 }
1627 1627
1628 void FFmpegDemuxer::OnEnabledAudioTracksChanged( 1628 void FFmpegDemuxer::OnEnabledAudioTracksChanged(
1629 const std::vector<MediaTrack::Id>& track_ids, 1629 const std::vector<MediaTrack::Id>& track_ids,
1630 base::TimeDelta currTime) { 1630 base::TimeDelta currTime) {
1631 DCHECK(task_runner_->BelongsToCurrentThread()); 1631 DCHECK(task_runner_->BelongsToCurrentThread());
1632 1632
1633 std::set<DemuxerStream*> enabled_streams; 1633 std::set<FFmpegDemuxerStream*> enabled_streams;
1634 for (const auto& id : track_ids) { 1634 for (const auto& id : track_ids) {
1635 DemuxerStream* stream = track_id_to_demux_stream_map_[id]; 1635 FFmpegDemuxerStream* stream = track_id_to_demux_stream_map_[id];
1636 DCHECK(stream); 1636 DCHECK(stream);
1637 DCHECK_EQ(DemuxerStream::AUDIO, stream->type()); 1637 DCHECK_EQ(DemuxerStream::AUDIO, stream->type());
1638 enabled_streams.insert(stream); 1638 enabled_streams.insert(stream);
1639 } 1639 }
1640 1640
1641 // First disable all streams that need to be disabled and then enable streams 1641 // First disable all streams that need to be disabled and then enable streams
1642 // that are enabled. 1642 // that are enabled.
1643 for (const auto& stream : streams_) { 1643 for (const auto& stream : streams_) {
1644 if (stream && stream->type() == DemuxerStream::AUDIO && 1644 if (stream && stream->type() == DemuxerStream::AUDIO &&
1645 enabled_streams.find(stream.get()) == enabled_streams.end()) { 1645 enabled_streams.find(stream.get()) == enabled_streams.end()) {
1646 DVLOG(1) << __func__ << ": disabling stream " << stream.get(); 1646 DVLOG(1) << __func__ << ": disabling stream " << stream.get();
1647 stream->set_enabled(false, currTime); 1647 stream->set_enabled(false, currTime);
1648 } 1648 }
1649 } 1649 }
1650 for (const auto& stream : enabled_streams) { 1650 for (const auto& stream : enabled_streams) {
1651 DCHECK(stream); 1651 DCHECK(stream);
1652 DVLOG(1) << __func__ << ": enabling stream " << stream; 1652 DVLOG(1) << __func__ << ": enabling stream " << stream;
1653 stream->set_enabled(true, currTime); 1653 stream->set_enabled(true, currTime);
1654 } 1654 }
1655 } 1655 }
1656 1656
1657 void FFmpegDemuxer::OnSelectedVideoTrackChanged( 1657 void FFmpegDemuxer::OnSelectedVideoTrackChanged(
1658 const std::vector<MediaTrack::Id>& track_ids, 1658 const std::vector<MediaTrack::Id>& track_ids,
1659 base::TimeDelta currTime) { 1659 base::TimeDelta currTime) {
1660 DCHECK(task_runner_->BelongsToCurrentThread()); 1660 DCHECK(task_runner_->BelongsToCurrentThread());
1661 DCHECK_LE(track_ids.size(), 1u); 1661 DCHECK_LE(track_ids.size(), 1u);
1662 1662
1663 DemuxerStream* selected_stream = nullptr; 1663 FFmpegDemuxerStream* selected_stream = nullptr;
1664 if (!track_ids.empty()) { 1664 if (!track_ids.empty()) {
1665 selected_stream = track_id_to_demux_stream_map_[track_ids[0]]; 1665 selected_stream = track_id_to_demux_stream_map_[track_ids[0]];
1666 DCHECK(selected_stream); 1666 DCHECK(selected_stream);
1667 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type()); 1667 DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type());
1668 } 1668 }
1669 1669
1670 // First disable all streams that need to be disabled and then enable the 1670 // First disable all streams that need to be disabled and then enable the
1671 // stream that needs to be enabled (if any). 1671 // stream that needs to be enabled (if any).
1672 for (const auto& stream : streams_) { 1672 for (const auto& stream : streams_) {
1673 if (stream && stream->type() == DemuxerStream::VIDEO && 1673 if (stream && stream->type() == DemuxerStream::VIDEO &&
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 1830
1831 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1831 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1832 DCHECK(task_runner_->BelongsToCurrentThread()); 1832 DCHECK(task_runner_->BelongsToCurrentThread());
1833 for (const auto& stream : streams_) { 1833 for (const auto& stream : streams_) {
1834 if (stream) 1834 if (stream)
1835 stream->SetLiveness(liveness); 1835 stream->SetLiveness(liveness);
1836 } 1836 }
1837 } 1837 }
1838 1838
1839 } // namespace media 1839 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698