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 #include "media/filters/frame_processor.h" | 5 #include "media/filters/frame_processor.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 #include "media/base/stream_parser_buffer.h" | 9 #include "media/base/stream_parser_buffer.h" |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 // 7.2. - 7.5.: | 229 // 7.2. - 7.5.: |
230 Reset(); | 230 Reset(); |
231 | 231 |
232 // 7.6. Jump to the Loop Top step above to restart processing of the | 232 // 7.6. Jump to the Loop Top step above to restart processing of the |
233 // current coded frame. | 233 // current coded frame. |
234 DVLOG(3) << __FUNCTION__ << ": Discontinuity: reprocessing frame"; | 234 DVLOG(3) << __FUNCTION__ << ": Discontinuity: reprocessing frame"; |
235 continue; | 235 continue; |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 // 8. If the presentation timestamp or decode timestamp is less than the | |
240 // presentation start time, then run the end of stream algorithm with the | |
241 // error parameter set to "decode", and abort these steps. | |
242 if (presentation_timestamp < base::TimeDelta() || | |
243 decode_timestamp < base::TimeDelta()) { | |
244 DVLOG(2) << __FUNCTION__ | |
245 << ": frame PTS=" << presentation_timestamp.InSecondsF() | |
246 << " or DTS=" << decode_timestamp.InSecondsF() | |
247 << " negative after applying timestampOffset and handling any " | |
248 << " discontinuity"; | |
249 return false; | |
250 } | |
251 | |
252 // 9. Let frame end timestamp equal the sum of presentation timestamp and | 239 // 9. Let frame end timestamp equal the sum of presentation timestamp and |
253 // frame duration. | 240 // frame duration. |
254 base::TimeDelta frame_end_timestamp = presentation_timestamp + | 241 base::TimeDelta frame_end_timestamp = presentation_timestamp + |
255 frame_duration; | 242 frame_duration; |
256 | 243 |
257 // 10. If presentation timestamp is less than appendWindowStart, then set | 244 // 10. If presentation timestamp is less than appendWindowStart, then set |
258 // the need random access point flag to true, drop the coded frame, and | 245 // the need random access point flag to true, drop the coded frame, and |
259 // jump to the top of the loop to start processing the next coded | 246 // jump to the top of the loop to start processing the next coded |
260 // frame. | 247 // frame. |
261 // Note: We keep the result of partial discard of a buffer that overlaps | 248 // Note: We keep the result of partial discard of a buffer that overlaps |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 // This also triggers a discontinuity so we need to treat the next | 284 // This also triggers a discontinuity so we need to treat the next |
298 // frames appended within the append window as if they were the | 285 // frames appended within the append window as if they were the |
299 // beginning of a new segment. | 286 // beginning of a new segment. |
300 *new_media_segment = true; | 287 *new_media_segment = true; |
301 } | 288 } |
302 | 289 |
303 return true; | 290 return true; |
304 } | 291 } |
305 } | 292 } |
306 | 293 |
294 // Note: This step is relocated, versus April 1 spec, to after append window | |
295 // filtering to allow more than 1 full frame preroll to support gapless | |
acolwell GONE FROM CHROMIUM
2014/05/24 05:27:36
nit: I don't think this comment needs to be AAC sp
wolenetz
2014/05/27 19:35:14
Done.
| |
296 // AAC beginning at time 0. This relocation verifies only the frames that | |
297 // survive append window filtering, rather than checking before append | |
298 // window filtering. | |
299 // 8. If the presentation timestamp or decode timestamp is less than the | |
300 // presentation start time, then run the end of stream algorithm with the | |
301 // error parameter set to "decode", and abort these steps. | |
302 if (presentation_timestamp < base::TimeDelta() || | |
acolwell GONE FROM CHROMIUM
2014/05/24 05:27:36
Yes. I believe the spec should probably be updated
wolenetz
2014/05/27 19:35:14
For PTS, added DCHECK.
For DTS < 0: I've added a n
| |
303 decode_timestamp < base::TimeDelta()) { | |
304 DVLOG(2) << __FUNCTION__ | |
305 << ": frame PTS=" << presentation_timestamp.InSecondsF() | |
306 << " or DTS=" << decode_timestamp.InSecondsF() | |
307 << " negative after applying timestampOffset and handling any " | |
308 << " discontinuity"; | |
309 return false; | |
310 } | |
311 | |
307 // 12. If the need random access point flag on track buffer equals true, | 312 // 12. If the need random access point flag on track buffer equals true, |
308 // then run the following steps: | 313 // then run the following steps: |
309 if (track_buffer->needs_random_access_point()) { | 314 if (track_buffer->needs_random_access_point()) { |
310 // 12.1. If the coded frame is not a random access point, then drop the | 315 // 12.1. If the coded frame is not a random access point, then drop the |
311 // coded frame and jump to the top of the loop to start processing | 316 // coded frame and jump to the top of the loop to start processing |
312 // the next coded frame. | 317 // the next coded frame. |
313 if (!frame->IsKeyframe()) { | 318 if (!frame->IsKeyframe()) { |
314 DVLOG(3) << __FUNCTION__ | 319 DVLOG(3) << __FUNCTION__ |
315 << ": Dropping frame that is not a random access point"; | 320 << ": Dropping frame that is not a random access point"; |
316 return true; | 321 return true; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 | 355 |
351 // 21. If highest presentation timestamp for track buffer is unset or frame | 356 // 21. If highest presentation timestamp for track buffer is unset or frame |
352 // end timestamp is greater than highest presentation timestamp, then | 357 // end timestamp is greater than highest presentation timestamp, then |
353 // set highest presentation timestamp for track buffer to frame end | 358 // set highest presentation timestamp for track buffer to frame end |
354 // timestamp. | 359 // timestamp. |
355 track_buffer->SetHighestPresentationTimestampIfIncreased( | 360 track_buffer->SetHighestPresentationTimestampIfIncreased( |
356 frame_end_timestamp); | 361 frame_end_timestamp); |
357 | 362 |
358 // 22. If frame end timestamp is greater than group end timestamp, then set | 363 // 22. If frame end timestamp is greater than group end timestamp, then set |
359 // group end timestamp equal to frame end timestamp. | 364 // group end timestamp equal to frame end timestamp. |
360 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | |
361 if (frame_end_timestamp > group_end_timestamp_) | 365 if (frame_end_timestamp > group_end_timestamp_) |
362 group_end_timestamp_ = frame_end_timestamp; | 366 group_end_timestamp_ = frame_end_timestamp; |
367 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | |
363 | 368 |
364 return true; | 369 return true; |
365 } | 370 } |
366 | 371 |
367 NOTREACHED(); | 372 NOTREACHED(); |
368 return false; | 373 return false; |
369 } | 374 } |
370 | 375 |
371 void FrameProcessor::SetAllTrackBuffersNeedRandomAccessPoint() { | 376 void FrameProcessor::SetAllTrackBuffersNeedRandomAccessPoint() { |
372 for (TrackBufferMap::iterator itr = track_buffers_.begin(); | 377 for (TrackBufferMap::iterator itr = track_buffers_.begin(); |
373 itr != track_buffers_.end(); ++itr) { | 378 itr != track_buffers_.end(); ++itr) { |
374 itr->second->set_needs_random_access_point(true); | 379 itr->second->set_needs_random_access_point(true); |
375 } | 380 } |
376 } | 381 } |
377 | 382 |
378 } // namespace media | 383 } // namespace media |
OLD | NEW |