| Index: media/filters/media_source_state.cc
|
| diff --git a/media/filters/media_source_state.cc b/media/filters/media_source_state.cc
|
| index d59011d6f87c6b339a0af291e1fce7b25fc5b6ad..98028b40a00cc9cb59a6208628ed90c152362829 100644
|
| --- a/media/filters/media_source_state.cc
|
| +++ b/media/filters/media_source_state.cc
|
| @@ -480,22 +480,9 @@ bool MediaSourceState::OnNewConfigs(
|
| const StreamParser::TextTrackConfigMap& text_configs) {
|
| DCHECK_GE(state_, PENDING_PARSER_CONFIG);
|
| DCHECK(tracks.get());
|
| -
|
| - const MediaTrack* audio_track = nullptr;
|
| - const MediaTrack* video_track = nullptr;
|
| - AudioDecoderConfig audio_config;
|
| - VideoDecoderConfig video_config;
|
| - for (const auto& track : tracks->tracks()) {
|
| - if (!audio_track && track->type() == MediaTrack::Audio &&
|
| - tracks->getAudioConfig(track->id()).IsValidConfig()) {
|
| - audio_config = tracks->getAudioConfig(track->id());
|
| - audio_track = track.get();
|
| - } else if (!video_track && track->type() == MediaTrack::Video &&
|
| - tracks->getVideoConfig(track->id()).IsValidConfig()) {
|
| - video_config = tracks->getVideoConfig(track->id());
|
| - video_track = track.get();
|
| - }
|
| - }
|
| + media_tracks_ = std::move(tracks);
|
| + const AudioDecoderConfig& audio_config = media_tracks_->getFirstAudioConfig();
|
| + const VideoDecoderConfig& video_config = media_tracks_->getFirstVideoConfig();
|
|
|
| DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video << ", "
|
| << audio_config.IsValidConfig() << ", "
|
| @@ -543,8 +530,7 @@ bool MediaSourceState::OnNewConfigs(
|
| }
|
|
|
| if (!audio_) {
|
| - DCHECK(audio_track);
|
| - audio_ = create_demuxer_stream_cb_.Run(*audio_track);
|
| + audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO);
|
|
|
| if (!audio_) {
|
| DVLOG(1) << "Failed to create an audio stream.";
|
| @@ -572,8 +558,7 @@ bool MediaSourceState::OnNewConfigs(
|
| }
|
|
|
| if (!video_) {
|
| - DCHECK(video_track);
|
| - video_ = create_demuxer_stream_cb_.Run(*video_track);
|
| + video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO);
|
|
|
| if (!video_) {
|
| DVLOG(1) << "Failed to create a video stream.";
|
| @@ -593,11 +578,8 @@ 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(dummy_text_track);
|
| + create_demuxer_stream_cb_.Run(DemuxerStream::TEXT);
|
| if (!frame_processor_->AddTrack(itr->first, text_stream)) {
|
| success &= false;
|
| MEDIA_LOG(ERROR, media_log_) << "Failed to add text track ID "
|
| @@ -669,21 +651,12 @@ bool MediaSourceState::OnNewConfigs(
|
|
|
| frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint();
|
|
|
| - if (audio_track) {
|
| - DCHECK(audio_);
|
| - tracks->SetDemuxerStreamForMediaTrack(audio_track, audio_);
|
| - }
|
| - if (video_track) {
|
| - DCHECK(video_);
|
| - tracks->SetDemuxerStreamForMediaTrack(video_track, video_);
|
| - }
|
| -
|
| DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed");
|
| if (success) {
|
| if (state_ == PENDING_PARSER_CONFIG)
|
| state_ = PENDING_PARSER_INIT;
|
| DCHECK(!init_segment_received_cb_.is_null());
|
| - init_segment_received_cb_.Run(std::move(tracks));
|
| + init_segment_received_cb_.Run(std::move(media_tracks_));
|
| }
|
|
|
| return success;
|
|
|