| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FRAME_PROCESSOR_H_ | 5 #ifndef MEDIA_FILTERS_FRAME_PROCESSOR_H_ |
| 6 #define MEDIA_FILTERS_FRAME_PROCESSOR_H_ | 6 #define MEDIA_FILTERS_FRAME_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Signals the frame processor to update its group start timestamp to be | 51 // Signals the frame processor to update its group start timestamp to be |
| 52 // |timestamp_offset| if it is in sequence append mode. | 52 // |timestamp_offset| if it is in sequence append mode. |
| 53 void SetGroupStartTimestampIfInSequenceMode(base::TimeDelta timestamp_offset); | 53 void SetGroupStartTimestampIfInSequenceMode(base::TimeDelta timestamp_offset); |
| 54 | 54 |
| 55 // Adds a new track with unique track ID |id|. | 55 // Adds a new track with unique track ID |id|. |
| 56 // If |id| has previously been added, returns false to indicate error. | 56 // If |id| has previously been added, returns false to indicate error. |
| 57 // Otherwise, returns true, indicating future ProcessFrames() will emit | 57 // Otherwise, returns true, indicating future ProcessFrames() will emit |
| 58 // frames for the track |id| to |stream|. | 58 // frames for the track |id| to |stream|. |
| 59 bool AddTrack(StreamParser::TrackId id, ChunkDemuxerStream* stream); | 59 bool AddTrack(StreamParser::TrackId id, ChunkDemuxerStream* stream); |
| 60 | 60 |
| 61 // Updates the internal mapping of TrackId to track buffer for the track | 61 // A map that describes how track ids changed between init segment. Maps the |
| 62 // buffer formerly associated with |old_id| to be associated with |new_id|. | 62 // old track id for a new track id for the same track. |
| 63 // Returns false to indicate failure due to either no existing track buffer | 63 using TrackIdChanges = std::map<StreamParser::TrackId, StreamParser::TrackId>; |
| 64 // for |old_id| or collision with previous track buffer already mapped to | 64 |
| 65 // |new_id|. Otherwise returns true. | 65 // Updates the internal mapping of TrackIds to track buffers. The input |
| 66 bool UpdateTrack(StreamParser::TrackId old_id, StreamParser::TrackId new_id); | 66 // parameter |track_id_changes| maps old track ids to new ones. The track ids |
| 67 // not present in the map must be assumed unchanged. Returns false if |
| 68 // remapping failed. |
| 69 bool UpdateTrackIds(const TrackIdChanges& track_id_changes); |
| 67 | 70 |
| 68 // Sets the need random access point flag on all track buffers to true. | 71 // Sets the need random access point flag on all track buffers to true. |
| 69 void SetAllTrackBuffersNeedRandomAccessPoint(); | 72 void SetAllTrackBuffersNeedRandomAccessPoint(); |
| 70 | 73 |
| 71 // Resets state for the coded frame processing algorithm as described in steps | 74 // Resets state for the coded frame processing algorithm as described in steps |
| 72 // 2-5 of the MSE Reset Parser State algorithm described at | 75 // 2-5 of the MSE Reset Parser State algorithm described at |
| 73 // http://www.w3.org/TR/media-source/#sourcebuffer-reset-parser-state | 76 // http://www.w3.org/TR/media-source/#sourcebuffer-reset-parser-state |
| 74 void Reset(); | 77 void Reset(); |
| 75 | 78 |
| 76 // Must be called when the audio config is updated. Used to manage when | 79 // Must be called when the audio config is updated. Used to manage when |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const scoped_refptr<StreamParserBuffer>& buffer); | 119 const scoped_refptr<StreamParserBuffer>& buffer); |
| 117 | 120 |
| 118 // Helper that processes one frame with the coded frame processing algorithm. | 121 // Helper that processes one frame with the coded frame processing algorithm. |
| 119 // Returns false on error or true on success. | 122 // Returns false on error or true on success. |
| 120 bool ProcessFrame(const scoped_refptr<StreamParserBuffer>& frame, | 123 bool ProcessFrame(const scoped_refptr<StreamParserBuffer>& frame, |
| 121 base::TimeDelta append_window_start, | 124 base::TimeDelta append_window_start, |
| 122 base::TimeDelta append_window_end, | 125 base::TimeDelta append_window_end, |
| 123 base::TimeDelta* timestamp_offset); | 126 base::TimeDelta* timestamp_offset); |
| 124 | 127 |
| 125 // TrackId-indexed map of each track's stream. | 128 // TrackId-indexed map of each track's stream. |
| 126 std::map<StreamParser::TrackId, std::unique_ptr<MseTrackBuffer>> | 129 using TrackBuffersMap = |
| 127 track_buffers_; | 130 std::map<StreamParser::TrackId, std::unique_ptr<MseTrackBuffer>>; |
| 131 TrackBuffersMap track_buffers_; |
| 128 | 132 |
| 129 // The last audio buffer seen by the frame processor that was removed because | 133 // The last audio buffer seen by the frame processor that was removed because |
| 130 // it was entirely before the start of the append window. | 134 // it was entirely before the start of the append window. |
| 131 scoped_refptr<StreamParserBuffer> audio_preroll_buffer_; | 135 scoped_refptr<StreamParserBuffer> audio_preroll_buffer_; |
| 132 | 136 |
| 133 // The AudioDecoderConfig associated with buffers handed to ProcessFrames(). | 137 // The AudioDecoderConfig associated with buffers handed to ProcessFrames(). |
| 134 AudioDecoderConfig current_audio_config_; | 138 AudioDecoderConfig current_audio_config_; |
| 135 base::TimeDelta sample_duration_; | 139 base::TimeDelta sample_duration_; |
| 136 | 140 |
| 137 // The AppendMode of the associated SourceBuffer. | 141 // The AppendMode of the associated SourceBuffer. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Counters that limit spam to |media_log_| for frame processor warnings. | 175 // Counters that limit spam to |media_log_| for frame processor warnings. |
| 172 int num_dropped_preroll_warnings_ = 0; | 176 int num_dropped_preroll_warnings_ = 0; |
| 173 int num_dts_beyond_pts_warnings_ = 0; | 177 int num_dts_beyond_pts_warnings_ = 0; |
| 174 | 178 |
| 175 DISALLOW_COPY_AND_ASSIGN(FrameProcessor); | 179 DISALLOW_COPY_AND_ASSIGN(FrameProcessor); |
| 176 }; | 180 }; |
| 177 | 181 |
| 178 } // namespace media | 182 } // namespace media |
| 179 | 183 |
| 180 #endif // MEDIA_FILTERS_FRAME_PROCESSOR_H_ | 184 #endif // MEDIA_FILTERS_FRAME_PROCESSOR_H_ |
| OLD | NEW |