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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 2718483003: Use base::Optional for selected video track. (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 42cafad807d90839113854790fe97308895762b1..5f1fc9978109594a8b4c80bd8f417ab5f1b05129 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -693,7 +693,7 @@ base::TimeDelta ChunkDemuxer::GetHighestPresentationTimestamp(
void ChunkDemuxer::OnEnabledAudioTracksChanged(
const std::vector<MediaTrack::Id>& track_ids,
- base::TimeDelta currTime) {
+ base::TimeDelta curr_time) {
base::AutoLock auto_lock(lock_);
std::set<ChunkDemuxerStream*> enabled_streams;
for (const auto& id : track_ids) {
@@ -708,24 +708,22 @@ void ChunkDemuxer::OnEnabledAudioTracksChanged(
for (const auto& stream : audio_streams_) {
if (enabled_streams.find(stream.get()) == enabled_streams.end()) {
DVLOG(1) << __func__ << ": disabling stream " << stream.get();
- stream->set_enabled(false, currTime);
+ stream->set_enabled(false, curr_time);
}
}
for (auto* stream : enabled_streams) {
DVLOG(1) << __func__ << ": enabling stream " << stream;
- stream->set_enabled(true, currTime);
+ stream->set_enabled(true, curr_time);
}
}
void ChunkDemuxer::OnSelectedVideoTrackChanged(
- const std::vector<MediaTrack::Id>& track_ids,
- base::TimeDelta currTime) {
- DCHECK_LE(track_ids.size(), 1u);
-
+ base::Optional<MediaTrack::Id> track_id,
+ base::TimeDelta curr_time) {
base::AutoLock auto_lock(lock_);
ChunkDemuxerStream* selected_stream = nullptr;
- if (!track_ids.empty()) {
- selected_stream = track_id_to_demux_stream_map_[track_ids[0]];
+ if (track_id) {
+ selected_stream = track_id_to_demux_stream_map_[*track_id];
DCHECK(selected_stream);
DCHECK_EQ(DemuxerStream::VIDEO, selected_stream->type());
}
@@ -736,12 +734,12 @@ void ChunkDemuxer::OnSelectedVideoTrackChanged(
if (stream.get() != selected_stream) {
DVLOG(1) << __func__ << ": disabling stream " << stream.get();
DCHECK_EQ(DemuxerStream::VIDEO, stream->type());
- stream->set_enabled(false, currTime);
+ stream->set_enabled(false, curr_time);
}
}
if (selected_stream) {
DVLOG(1) << __func__ << ": enabling stream " << selected_stream;
- selected_stream->set_enabled(true, currTime);
+ selected_stream->set_enabled(true, curr_time);
}
}
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698