| Index: media/filters/media_source_state.cc
|
| diff --git a/media/filters/media_source_state.cc b/media/filters/media_source_state.cc
|
| index ede96052668fb086df2664f5a11b3f36b647b6ca..a8da3037fcd07ef6641fb2a31cba5f09c89a0daa 100644
|
| --- a/media/filters/media_source_state.cc
|
| +++ b/media/filters/media_source_state.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "base/callback_helpers.h"
|
| #include "base/stl_util.h"
|
| +#include "media/base/media_track.h"
|
| +#include "media/base/media_tracks.h"
|
| #include "media/filters/chunk_demuxer.h"
|
| #include "media/filters/frame_processor.h"
|
| #include "media/filters/source_buffer_stream.h"
|
| @@ -143,21 +145,24 @@ void MediaSourceState::SetGroupStartTimestampIfInSequenceMode(
|
| frame_processor_->SetGroupStartTimestampIfInSequenceMode(timestamp_offset);
|
| }
|
|
|
| -bool MediaSourceState::Append(
|
| - const uint8_t* data,
|
| - size_t length,
|
| - TimeDelta append_window_start,
|
| - TimeDelta append_window_end,
|
| - TimeDelta* timestamp_offset,
|
| - const InitSegmentReceivedCB& init_segment_received_cb) {
|
| +void MediaSourceState::SetTracksWatcher(
|
| + const Demuxer::MediaTracksUpdatedCB& tracks_updated_cb) {
|
| + DCHECK(init_segment_received_cb_.is_null());
|
| + init_segment_received_cb_ = tracks_updated_cb;
|
| + DCHECK(!init_segment_received_cb_.is_null());
|
| +}
|
| +
|
| +bool MediaSourceState::Append(const uint8_t* data,
|
| + size_t length,
|
| + TimeDelta append_window_start,
|
| + TimeDelta append_window_end,
|
| + TimeDelta* timestamp_offset) {
|
| + append_in_progress_ = true;
|
| DCHECK(timestamp_offset);
|
| DCHECK(!timestamp_offset_during_append_);
|
| - DCHECK(!init_segment_received_cb.is_null());
|
| - DCHECK(init_segment_received_cb_.is_null());
|
| append_window_start_during_append_ = append_window_start;
|
| append_window_end_during_append_ = append_window_end;
|
| timestamp_offset_during_append_ = timestamp_offset;
|
| - init_segment_received_cb_ = init_segment_received_cb;
|
|
|
| // TODO(wolenetz/acolwell): Curry and pass a NewBuffersCB here bound with
|
| // append window and timestamp offset pointer. See http://crbug.com/351454.
|
| @@ -170,7 +175,7 @@ bool MediaSourceState::Append(
|
| << " append_window_end=" << append_window_end.InSecondsF();
|
| }
|
| timestamp_offset_during_append_ = NULL;
|
| - init_segment_received_cb_.Reset();
|
| + append_in_progress_ = false;
|
| return result;
|
| }
|
|
|
| @@ -468,13 +473,19 @@ bool MediaSourceState::IsSeekWaitingForData() const {
|
| bool MediaSourceState::OnNewConfigs(
|
| bool allow_audio,
|
| bool allow_video,
|
| - const AudioDecoderConfig& audio_config,
|
| - const VideoDecoderConfig& video_config,
|
| + scoped_ptr<MediaTracks> tracks,
|
| const StreamParser::TextTrackConfigMap& text_configs) {
|
| + DCHECK(tracks);
|
| + 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() << ", "
|
| << video_config.IsValidConfig() << ")";
|
| - DCHECK(!init_segment_received_cb_.is_null());
|
| + // MSE spec allows new configs to be emitted only during Append, but not
|
| + // during Flush or parser reset operations.
|
| + CHECK(append_in_progress_);
|
|
|
| if (!audio_config.IsValidConfig() && !video_config.IsValidConfig()) {
|
| DVLOG(1) << "OnNewConfigs() : Audio & video config are not valid!";
|
| @@ -637,8 +648,10 @@ bool MediaSourceState::OnNewConfigs(
|
| frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint();
|
|
|
| DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed");
|
| - if (success)
|
| - init_segment_received_cb_.Run();
|
| + if (success) {
|
| + DCHECK(!init_segment_received_cb_.is_null());
|
| + init_segment_received_cb_.Run(std::move(media_tracks_));
|
| + }
|
|
|
| return success;
|
| }
|
|
|