| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ | 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ |
| 6 #define MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ | 6 #define MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Callback signature used to create ChunkDemuxerStreams. | 32 // Callback signature used to create ChunkDemuxerStreams. |
| 33 typedef base::Callback<ChunkDemuxerStream*(DemuxerStream::Type)> | 33 typedef base::Callback<ChunkDemuxerStream*(DemuxerStream::Type)> |
| 34 CreateDemuxerStreamCB; | 34 CreateDemuxerStreamCB; |
| 35 | 35 |
| 36 typedef base::Callback<void(ChunkDemuxerStream*, const TextTrackConfig&)> | 36 typedef base::Callback<void(ChunkDemuxerStream*, const TextTrackConfig&)> |
| 37 NewTextTrackCB; | 37 NewTextTrackCB; |
| 38 | 38 |
| 39 SourceBufferState(std::unique_ptr<StreamParser> stream_parser, | 39 SourceBufferState(std::unique_ptr<StreamParser> stream_parser, |
| 40 std::unique_ptr<FrameProcessor> frame_processor, | 40 std::unique_ptr<FrameProcessor> frame_processor, |
| 41 const CreateDemuxerStreamCB& create_demuxer_stream_cb, | 41 const CreateDemuxerStreamCB& create_demuxer_stream_cb, |
| 42 const scoped_refptr<MediaLog>& media_log); | 42 MediaLog* media_log); |
| 43 | 43 |
| 44 ~SourceBufferState(); | 44 ~SourceBufferState(); |
| 45 | 45 |
| 46 void Init(const StreamParser::InitCB& init_cb, | 46 void Init(const StreamParser::InitCB& init_cb, |
| 47 const std::string& expected_codecs, | 47 const std::string& expected_codecs, |
| 48 const StreamParser::EncryptedMediaInitDataCB& | 48 const StreamParser::EncryptedMediaInitDataCB& |
| 49 encrypted_media_init_data_cb, | 49 encrypted_media_init_data_cb, |
| 50 const NewTextTrackCB& new_text_track_cb); | 50 const NewTextTrackCB& new_text_track_cb); |
| 51 | 51 |
| 52 // Appends new data to the StreamParser. | 52 // Appends new data to the StreamParser. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 std::unique_ptr<StreamParser> stream_parser_; | 202 std::unique_ptr<StreamParser> stream_parser_; |
| 203 | 203 |
| 204 // Note that ChunkDemuxerStreams are created and owned by the parent | 204 // Note that ChunkDemuxerStreams are created and owned by the parent |
| 205 // ChunkDemuxer. They are not owned by |this|. | 205 // ChunkDemuxer. They are not owned by |this|. |
| 206 using DemuxerStreamMap = std::map<StreamParser::TrackId, ChunkDemuxerStream*>; | 206 using DemuxerStreamMap = std::map<StreamParser::TrackId, ChunkDemuxerStream*>; |
| 207 DemuxerStreamMap audio_streams_; | 207 DemuxerStreamMap audio_streams_; |
| 208 DemuxerStreamMap video_streams_; | 208 DemuxerStreamMap video_streams_; |
| 209 DemuxerStreamMap text_streams_; | 209 DemuxerStreamMap text_streams_; |
| 210 | 210 |
| 211 std::unique_ptr<FrameProcessor> frame_processor_; | 211 std::unique_ptr<FrameProcessor> frame_processor_; |
| 212 scoped_refptr<MediaLog> media_log_; | 212 MediaLog* media_log_; |
| 213 StreamParser::InitCB init_cb_; | 213 StreamParser::InitCB init_cb_; |
| 214 | 214 |
| 215 State state_; | 215 State state_; |
| 216 | 216 |
| 217 // During Append(), OnNewConfigs() will trigger the initialization segment | 217 // During Append(), OnNewConfigs() will trigger the initialization segment |
| 218 // received algorithm. Note, the MSE spec explicitly disallows this algorithm | 218 // received algorithm. Note, the MSE spec explicitly disallows this algorithm |
| 219 // during an Abort(), since Abort() is allowed only to emit coded frames, and | 219 // during an Abort(), since Abort() is allowed only to emit coded frames, and |
| 220 // only if the parser is PARSING_MEDIA_SEGMENT (not an INIT segment). So we | 220 // only if the parser is PARSING_MEDIA_SEGMENT (not an INIT segment). So we |
| 221 // also have a flag here that indicates if Append is in progress and we can | 221 // also have a flag here that indicates if Append is in progress and we can |
| 222 // invoke this callback. | 222 // invoke this callback. |
| 223 Demuxer::MediaTracksUpdatedCB init_segment_received_cb_; | 223 Demuxer::MediaTracksUpdatedCB init_segment_received_cb_; |
| 224 bool append_in_progress_ = false; | 224 bool append_in_progress_ = false; |
| 225 bool first_init_segment_received_ = false; | 225 bool first_init_segment_received_ = false; |
| 226 | 226 |
| 227 std::vector<AudioCodec> expected_audio_codecs_; | 227 std::vector<AudioCodec> expected_audio_codecs_; |
| 228 std::vector<VideoCodec> expected_video_codecs_; | 228 std::vector<VideoCodec> expected_video_codecs_; |
| 229 | 229 |
| 230 // Indicates that timestampOffset should be updated automatically during | 230 // Indicates that timestampOffset should be updated automatically during |
| 231 // OnNewBuffers() based on the earliest end timestamp of the buffers provided. | 231 // OnNewBuffers() based on the earliest end timestamp of the buffers provided. |
| 232 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 | 232 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 |
| 233 // changes to MSE spec. See http://crbug.com/371499. | 233 // changes to MSE spec. See http://crbug.com/371499. |
| 234 bool auto_update_timestamp_offset_; | 234 bool auto_update_timestamp_offset_; |
| 235 | 235 |
| 236 DISALLOW_COPY_AND_ASSIGN(SourceBufferState); | 236 DISALLOW_COPY_AND_ASSIGN(SourceBufferState); |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 } // namespace media | 239 } // namespace media |
| 240 | 240 |
| 241 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ | 241 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ |
| OLD | NEW |