| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 const StreamParser::TextBufferQueueMap& text_map); | 145 const StreamParser::TextBufferQueueMap& text_map); |
| 146 | 146 |
| 147 void OnSourceInitDone(const StreamParser::InitParameters& params); | 147 void OnSourceInitDone(const StreamParser::InitParameters& params); |
| 148 | 148 |
| 149 // EstimateVideoDataSize uses some heuristics to estimate the size of the | 149 // EstimateVideoDataSize uses some heuristics to estimate the size of the |
| 150 // video size in the chunk of muxed audio/video data without parsing it. | 150 // video size in the chunk of muxed audio/video data without parsing it. |
| 151 // This is used by EvictCodedFrames algorithm, which happens before Append | 151 // This is used by EvictCodedFrames algorithm, which happens before Append |
| 152 // (and therefore before parsing is performed) to prepare space for new data. | 152 // (and therefore before parsing is performed) to prepare space for new data. |
| 153 size_t EstimateVideoDataSize(size_t muxed_data_chunk_size) const; | 153 size_t EstimateVideoDataSize(size_t muxed_data_chunk_size) const; |
| 154 | 154 |
| 155 // Tracks the number of MEDIA_LOGs emitted for segments missing expected audio |
| 156 // or video blocks. Useful to prevent log spam. |
| 157 int num_missing_track_logs_ = 0; |
| 158 |
| 155 CreateDemuxerStreamCB create_demuxer_stream_cb_; | 159 CreateDemuxerStreamCB create_demuxer_stream_cb_; |
| 156 NewTextTrackCB new_text_track_cb_; | 160 NewTextTrackCB new_text_track_cb_; |
| 157 | 161 |
| 158 // During Append(), if OnNewBuffers() coded frame processing updates the | 162 // During Append(), if OnNewBuffers() coded frame processing updates the |
| 159 // timestamp offset then |*timestamp_offset_during_append_| is also updated | 163 // timestamp offset then |*timestamp_offset_during_append_| is also updated |
| 160 // so Append()'s caller can know the new offset. This pointer is only non-NULL | 164 // so Append()'s caller can know the new offset. This pointer is only non-NULL |
| 161 // during the lifetime of an Append() call. | 165 // during the lifetime of an Append() call. |
| 162 TimeDelta* timestamp_offset_during_append_; | 166 TimeDelta* timestamp_offset_during_append_; |
| 163 | 167 |
| 164 // During Append(), coded frame processing triggered by OnNewBuffers() | 168 // During Append(), coded frame processing triggered by OnNewBuffers() |
| 165 // requires these two attributes. These are only valid during the lifetime of | 169 // requires these two attributes. These are only valid during the lifetime of |
| 166 // an Append() call. | 170 // an Append() call. |
| 167 TimeDelta append_window_start_during_append_; | 171 TimeDelta append_window_start_during_append_; |
| 168 TimeDelta append_window_end_during_append_; | 172 TimeDelta append_window_end_during_append_; |
| 169 | 173 |
| 170 // Set to true if the next buffers appended within the append window | 174 // Set to true if the next buffers appended within the append window |
| 171 // represent the start of a new media segment. This flag being set | 175 // represent the start of a new media segment. This flag being set |
| 172 // triggers a call to |new_segment_cb_| when the new buffers are | 176 // triggers a call to |new_segment_cb_| when the new buffers are |
| 173 // appended. The flag is set on actual media segment boundaries and | 177 // appended. The flag is set on actual media segment boundaries and |
| 174 // when the "append window" filtering causes discontinuities in the | 178 // when the "append window" filtering causes discontinuities in the |
| 175 // appended data. | 179 // appended data. |
| 176 // TODO(wolenetz/acolwell): Investigate if we need this, or if coded frame | 180 // TODO(wolenetz/acolwell): Investigate if we need this, or if coded frame |
| 177 // processing's discontinuity logic is enough. See http://crbug.com/351489. | 181 // processing's discontinuity logic is enough. See http://crbug.com/351489. |
| 178 bool new_media_segment_; | 182 bool new_media_segment_; |
| 179 | 183 |
| 180 // Keeps track of whether a media segment is being parsed. | 184 // Keeps track of whether a media segment is being parsed. |
| 181 bool parsing_media_segment_; | 185 bool parsing_media_segment_; |
| 182 | 186 |
| 187 // Valid only while |parsing_media_segment_| is true. These flags enable |
| 188 // warning when at least one frame for each A/V track is not in a parsed media |
| 189 // segment. |
| 190 bool media_segment_contained_audio_frame_; |
| 191 bool media_segment_contained_video_frame_; |
| 192 |
| 183 // The object used to parse appended data. | 193 // The object used to parse appended data. |
| 184 scoped_ptr<StreamParser> stream_parser_; | 194 scoped_ptr<StreamParser> stream_parser_; |
| 185 | 195 |
| 186 ChunkDemuxerStream* audio_; // Not owned by |this|. | 196 ChunkDemuxerStream* audio_; // Not owned by |this|. |
| 187 ChunkDemuxerStream* video_; // Not owned by |this|. | 197 ChunkDemuxerStream* video_; // Not owned by |this|. |
| 188 | 198 |
| 189 typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap; | 199 typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap; |
| 190 TextStreamMap text_stream_map_; // |this| owns the map's stream pointers. | 200 TextStreamMap text_stream_map_; // |this| owns the map's stream pointers. |
| 191 | 201 |
| 192 scoped_ptr<FrameProcessor> frame_processor_; | 202 scoped_ptr<FrameProcessor> frame_processor_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 205 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 | 215 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 |
| 206 // changes to MSE spec. See http://crbug.com/371499. | 216 // changes to MSE spec. See http://crbug.com/371499. |
| 207 bool auto_update_timestamp_offset_; | 217 bool auto_update_timestamp_offset_; |
| 208 | 218 |
| 209 DISALLOW_COPY_AND_ASSIGN(MediaSourceState); | 219 DISALLOW_COPY_AND_ASSIGN(MediaSourceState); |
| 210 }; | 220 }; |
| 211 | 221 |
| 212 } // namespace media | 222 } // namespace media |
| 213 | 223 |
| 214 #endif // MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ | 224 #endif // MEDIA_FILTERS_MEDIA_SOURCE_STATE_H_ |
| OLD | NEW |