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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 1812543003: Allow muting/unmuting audio through media track API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-sb-tracks6
Patch Set: Avoid ChunkDemuxer/PipelineImpl deadlock Created 4 years, 8 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/ffmpeg_demuxer.h ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index c7e00ce5c5f235becbf20499e099c406f5ded6f6..c3d8525eaa024b12da5b9d16902db98b6a327639 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -1221,22 +1221,25 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
// Note when we find our audio/video stream (we only want one of each) and
// record src= playback UMA stats for the stream's decoder config.
+ const MediaTrack* media_track = nullptr;
if (codec_type == AVMEDIA_TYPE_AUDIO) {
CHECK(!audio_stream);
audio_stream = stream;
audio_config = streams_[i]->audio_decoder_config();
RecordAudioCodecStats(audio_config);
- media_tracks->AddAudioTrack(audio_config, track_id, "main", track_label,
- track_language);
+ media_track = media_tracks->AddAudioTrack(audio_config, track_id, "main",
+ track_label, track_language);
+ media_tracks->SetDemuxerStreamForMediaTrack(media_track, streams_[i]);
} else if (codec_type == AVMEDIA_TYPE_VIDEO) {
CHECK(!video_stream);
video_stream = stream;
video_config = streams_[i]->video_decoder_config();
RecordVideoCodecStats(video_config, stream->codec->color_range);
- media_tracks->AddVideoTrack(video_config, track_id, "main", track_label,
- track_language);
+ media_track = media_tracks->AddVideoTrack(video_config, track_id, "main",
+ track_label, track_language);
+ media_tracks->SetDemuxerStreamForMediaTrack(media_track, streams_[i]);
}
max_duration = std::max(max_duration, streams_[i]->duration());
@@ -1595,4 +1598,16 @@ void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
}
}
+void FFmpegDemuxer::OnTrackIdsAssigned(const MediaTracks& tracks,
+ const std::vector<unsigned>& track_ids) {
+ track_id_to_demux_stream_ = tracks.OnTrackIdsAssigned(track_ids);
+}
+
+const DemuxerStream* FFmpegDemuxer::GetDemuxerStreamByTrackId(
+ unsigned track_id) const {
+ const auto& it = track_id_to_demux_stream_.find(track_id);
+ CHECK(it != track_id_to_demux_stream_.end());
+ return it->second;
+}
+
} // namespace media
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698