| Index: media/filters/media_source_state.cc
|
| diff --git a/media/filters/media_source_state.cc b/media/filters/media_source_state.cc
|
| index 89d488ef21031b58eaf62f692f25f8f738ac2007..3b47b6e58380ab40610957c9aac95641abdf6f0e 100644
|
| --- a/media/filters/media_source_state.cc
|
| +++ b/media/filters/media_source_state.cc
|
| @@ -477,8 +477,22 @@ bool MediaSourceState::OnNewConfigs(
|
| const StreamParser::TextTrackConfigMap& text_configs) {
|
| DCHECK(tracks.get());
|
| media_tracks_ = std::move(tracks);
|
| - const AudioDecoderConfig& audio_config = media_tracks_->getFirstAudioConfig();
|
| - const VideoDecoderConfig& video_config = media_tracks_->getFirstVideoConfig();
|
| +
|
| + const MediaTrack* audio_track = nullptr;
|
| + const MediaTrack* video_track = nullptr;
|
| + AudioDecoderConfig audio_config;
|
| + VideoDecoderConfig video_config;
|
| + for (const auto& track : media_tracks_->tracks()) {
|
| + if (!audio_track && track->type() == MediaTrack::Audio &&
|
| + media_tracks_->getAudioConfig(track->id()).IsValidConfig()) {
|
| + audio_config = media_tracks_->getAudioConfig(track->id());
|
| + audio_track = track.get();
|
| + } else if (!video_track && track->type() == MediaTrack::Video &&
|
| + media_tracks_->getVideoConfig(track->id()).IsValidConfig()) {
|
| + video_config = media_tracks_->getVideoConfig(track->id());
|
| + video_track = track.get();
|
| + }
|
| + }
|
|
|
| DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video << ", "
|
| << audio_config.IsValidConfig() << ", "
|
| @@ -526,7 +540,8 @@ bool MediaSourceState::OnNewConfigs(
|
| }
|
|
|
| if (!audio_) {
|
| - audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO);
|
| + DCHECK(audio_track);
|
| + audio_ = create_demuxer_stream_cb_.Run(*audio_track);
|
|
|
| if (!audio_) {
|
| DVLOG(1) << "Failed to create an audio stream.";
|
| @@ -554,7 +569,8 @@ bool MediaSourceState::OnNewConfigs(
|
| }
|
|
|
| if (!video_) {
|
| - video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO);
|
| + DCHECK(video_track);
|
| + video_ = create_demuxer_stream_cb_.Run(*video_track);
|
|
|
| if (!video_) {
|
| DVLOG(1) << "Failed to create a video stream.";
|
| @@ -574,8 +590,11 @@ bool MediaSourceState::OnNewConfigs(
|
| if (text_stream_map_.empty()) {
|
| for (TextConfigItr itr = text_configs.begin(); itr != text_configs.end();
|
| ++itr) {
|
| + // TODO(servolk): Look into unifying text tracks code path with audio and
|
| + // video track code paths.
|
| + MediaTrack dummy_text_track(MediaTrack::Text, "", "", "", "");
|
| ChunkDemuxerStream* const text_stream =
|
| - create_demuxer_stream_cb_.Run(DemuxerStream::TEXT);
|
| + create_demuxer_stream_cb_.Run(dummy_text_track);
|
| if (!frame_processor_->AddTrack(itr->first, text_stream)) {
|
| success &= false;
|
| MEDIA_LOG(ERROR, media_log_) << "Failed to add text track ID "
|
|
|