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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 frame->SetDecodeTimestamp(decode_timestamp); | 254 frame->SetDecodeTimestamp(decode_timestamp); |
255 if (track_buffer->stream()->supports_partial_append_window_trimming() && | 255 if (track_buffer->stream()->supports_partial_append_window_trimming() && |
256 HandlePartialAppendWindowTrimming(append_window_start, | 256 HandlePartialAppendWindowTrimming(append_window_start, |
257 append_window_end, | 257 append_window_end, |
258 frame)) { | 258 frame)) { |
259 // If |frame| was shortened a discontinuity may exist, so treat the next | 259 // If |frame| was shortened a discontinuity may exist, so treat the next |
260 // frames appended as if they were the beginning of a new media segment. | 260 // frames appended as if they were the beginning of a new media segment. |
261 if (frame->timestamp() != presentation_timestamp && !sequence_mode_) | 261 if (frame->timestamp() != presentation_timestamp && !sequence_mode_) |
262 *new_media_segment = true; | 262 *new_media_segment = true; |
263 | 263 |
264 // |frame| has been partially trimmed or had preroll added. | 264 // |frame| has been partially trimmed or had preroll added. Though |
| 265 // |frame|'s duration may have changed, do not update |frame_duration| |
| 266 // here, so |track_buffer|'s last frame duration update uses original |
| 267 // frame duration and reduces spurious discontinuity detection. |
265 decode_timestamp = frame->GetDecodeTimestamp(); | 268 decode_timestamp = frame->GetDecodeTimestamp(); |
266 presentation_timestamp = frame->timestamp(); | 269 presentation_timestamp = frame->timestamp(); |
267 frame_duration = frame->duration(); | |
268 | 270 |
269 // The end timestamp of the frame should be unchanged. | 271 // The end timestamp of the frame should be unchanged. |
270 DCHECK(frame_end_timestamp == presentation_timestamp + frame_duration); | 272 DCHECK(frame_end_timestamp == presentation_timestamp + frame->duration()); |
271 } | 273 } |
272 | 274 |
273 if (presentation_timestamp < append_window_start || | 275 if (presentation_timestamp < append_window_start || |
274 frame_end_timestamp > append_window_end) { | 276 frame_end_timestamp > append_window_end) { |
275 track_buffer->set_needs_random_access_point(true); | 277 track_buffer->set_needs_random_access_point(true); |
276 DVLOG(3) << "Dropping frame that is outside append window."; | 278 DVLOG(3) << "Dropping frame that is outside append window."; |
277 | 279 |
278 if (!sequence_mode_) { | 280 if (!sequence_mode_) { |
279 // This also triggers a discontinuity so we need to treat the next | 281 // This also triggers a discontinuity so we need to treat the next |
280 // frames appended within the append window as if they were the | 282 // frames appended within the append window as if they were the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 364 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
363 | 365 |
364 return true; | 366 return true; |
365 } | 367 } |
366 | 368 |
367 NOTREACHED(); | 369 NOTREACHED(); |
368 return false; | 370 return false; |
369 } | 371 } |
370 | 372 |
371 } // namespace media | 373 } // namespace media |
OLD | NEW |