| 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_MEDIA_SOURCE_STATE_H_ | 5 #ifndef MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ |
| 6 #define MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ | 6 #define MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ChunkDemuxerStream; | 21 class ChunkDemuxerStream; |
| 22 class FrameProcessor; | 22 class FrameProcessor; |
| 23 | 23 |
| 24 // Contains state belonging to a source id. | 24 // Contains state belonging to a source id. |
| 25 class MEDIA_EXPORT MediaSourceState { | 25 class MEDIA_EXPORT MediaSourceState { |
| 26 public: | 26 public: |
| 27 // Callback signature used to create ChunkDemuxerStreams. | 27 // Callback signature used to create ChunkDemuxerStreams. |
| 28 typedef base::Callback<ChunkDemuxerStream*(DemuxerStream::Type)> | 28 typedef base::Callback<ChunkDemuxerStream*(DemuxerStream::Type)> |
| 29 CreateDemuxerStreamCB; | 29 CreateDemuxerStreamCB; |
| 30 | 30 |
| 31 typedef base::Closure InitSegmentReceivedCB; | 31 typedef base::Callback<void(const MediaTracks&)> InitSegmentReceivedCB; |
| 32 | 32 |
| 33 typedef base::Callback<void(ChunkDemuxerStream*, const TextTrackConfig&)> | 33 typedef base::Callback<void(ChunkDemuxerStream*, const TextTrackConfig&)> |
| 34 NewTextTrackCB; | 34 NewTextTrackCB; |
| 35 | 35 |
| 36 MediaSourceState(scoped_ptr<StreamParser> stream_parser, | 36 MediaSourceState(scoped_ptr<StreamParser> stream_parser, |
| 37 scoped_ptr<FrameProcessor> frame_processor, | 37 scoped_ptr<FrameProcessor> frame_processor, |
| 38 const CreateDemuxerStreamCB& create_demuxer_stream_cb, | 38 const CreateDemuxerStreamCB& create_demuxer_stream_cb, |
| 39 const scoped_refptr<MediaLog>& media_log); | 39 const scoped_refptr<MediaLog>& media_log); |
| 40 | 40 |
| 41 ~MediaSourceState(); | 41 ~MediaSourceState(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 const RangesList& activeRanges, | 117 const RangesList& activeRanges, |
| 118 bool ended); | 118 bool ended); |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 // Called by the |stream_parser_| when a new initialization segment is | 121 // Called by the |stream_parser_| when a new initialization segment is |
| 122 // encountered. | 122 // encountered. |
| 123 // Returns true on a successful call. Returns false if an error occurred while | 123 // Returns true on a successful call. Returns false if an error occurred while |
| 124 // processing decoder configurations. | 124 // processing decoder configurations. |
| 125 bool OnNewConfigs(bool allow_audio, | 125 bool OnNewConfigs(bool allow_audio, |
| 126 bool allow_video, | 126 bool allow_video, |
| 127 const AudioDecoderConfig& audio_config, | 127 scoped_ptr<MediaTracks> tracks, |
| 128 const VideoDecoderConfig& video_config, | |
| 129 const StreamParser::TextTrackConfigMap& text_configs); | 128 const StreamParser::TextTrackConfigMap& text_configs); |
| 130 | 129 |
| 131 // Called by the |stream_parser_| at the beginning of a new media segment. | 130 // Called by the |stream_parser_| at the beginning of a new media segment. |
| 132 void OnNewMediaSegment(); | 131 void OnNewMediaSegment(); |
| 133 | 132 |
| 134 // Called by the |stream_parser_| at the end of a media segment. | 133 // Called by the |stream_parser_| at the end of a media segment. |
| 135 void OnEndOfMediaSegment(); | 134 void OnEndOfMediaSegment(); |
| 136 | 135 |
| 137 // Called by the |stream_parser_| when new buffers have been parsed. | 136 // Called by the |stream_parser_| when new buffers have been parsed. |
| 138 // It processes the new buffers using |frame_processor_|, which includes | 137 // It processes the new buffers using |frame_processor_|, which includes |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 175 |
| 177 // Valid only while |parsing_media_segment_| is true. These flags enable | 176 // Valid only while |parsing_media_segment_| is true. These flags enable |
| 178 // warning when at least one frame for each A/V track is not in a parsed media | 177 // warning when at least one frame for each A/V track is not in a parsed media |
| 179 // segment. | 178 // segment. |
| 180 bool media_segment_contained_audio_frame_; | 179 bool media_segment_contained_audio_frame_; |
| 181 bool media_segment_contained_video_frame_; | 180 bool media_segment_contained_video_frame_; |
| 182 | 181 |
| 183 // The object used to parse appended data. | 182 // The object used to parse appended data. |
| 184 scoped_ptr<StreamParser> stream_parser_; | 183 scoped_ptr<StreamParser> stream_parser_; |
| 185 | 184 |
| 185 scoped_ptr<MediaTracks> media_tracks_; |
| 186 |
| 186 ChunkDemuxerStream* audio_; // Not owned by |this|. | 187 ChunkDemuxerStream* audio_; // Not owned by |this|. |
| 187 ChunkDemuxerStream* video_; // Not owned by |this|. | 188 ChunkDemuxerStream* video_; // Not owned by |this|. |
| 188 | 189 |
| 189 typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap; | 190 typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap; |
| 190 TextStreamMap text_stream_map_; // |this| owns the map's stream pointers. | 191 TextStreamMap text_stream_map_; // |this| owns the map's stream pointers. |
| 191 | 192 |
| 192 scoped_ptr<FrameProcessor> frame_processor_; | 193 scoped_ptr<FrameProcessor> frame_processor_; |
| 193 scoped_refptr<MediaLog> media_log_; | 194 scoped_refptr<MediaLog> media_log_; |
| 194 StreamParser::InitCB init_cb_; | 195 StreamParser::InitCB init_cb_; |
| 195 | 196 |
| 196 // During Append(), OnNewConfigs() will trigger the initialization segment | 197 // During Append(), OnNewConfigs() will trigger the initialization segment |
| 197 // received algorithm. This callback is only non-NULL during the lifetime of | 198 // received algorithm. This callback is only non-NULL during the lifetime of |
| 198 // an Append() call. Note, the MSE spec explicitly disallows this algorithm | 199 // an Append() call. Note, the MSE spec explicitly disallows this algorithm |
| 199 // during an Abort(), since Abort() is allowed only to emit coded frames, and | 200 // during an Abort(), since Abort() is allowed only to emit coded frames, and |
| 200 // only if the parser is PARSING_MEDIA_SEGMENT (not an INIT segment). | 201 // only if the parser is PARSING_MEDIA_SEGMENT (not an INIT segment). |
| 201 InitSegmentReceivedCB init_segment_received_cb_; | 202 InitSegmentReceivedCB init_segment_received_cb_; |
| 202 | 203 |
| 203 // Indicates that timestampOffset should be updated automatically during | 204 // Indicates that timestampOffset should be updated automatically during |
| 204 // OnNewBuffers() based on the earliest end timestamp of the buffers provided. | 205 // OnNewBuffers() based on the earliest end timestamp of the buffers provided. |
| 205 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 | 206 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 |
| 206 // changes to MSE spec. See http://crbug.com/371499. | 207 // changes to MSE spec. See http://crbug.com/371499. |
| 207 bool auto_update_timestamp_offset_; | 208 bool auto_update_timestamp_offset_; |
| 208 | 209 |
| 209 DISALLOW_COPY_AND_ASSIGN(MediaSourceState); | 210 DISALLOW_COPY_AND_ASSIGN(MediaSourceState); |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 } // namespace media | 213 } // namespace media |
| 213 | 214 |
| 214 #endif // MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ | 215 #endif // MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ |
| OLD | NEW |