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 <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // |append_window_start| and does not end after |append_window_end|. | 591 // |append_window_start| and does not end after |append_window_end|. |
592 // 11. If frame end timestamp is greater than appendWindowEnd, then set the | 592 // 11. If frame end timestamp is greater than appendWindowEnd, then set the |
593 // need random access point flag to true, drop the coded frame, and jump | 593 // need random access point flag to true, drop the coded frame, and jump |
594 // to the top of the loop to start processing the next coded frame. | 594 // to the top of the loop to start processing the next coded frame. |
595 frame->set_timestamp(presentation_timestamp); | 595 frame->set_timestamp(presentation_timestamp); |
596 frame->SetDecodeTimestamp(decode_timestamp); | 596 frame->SetDecodeTimestamp(decode_timestamp); |
597 if (track_buffer->stream()->supports_partial_append_window_trimming() && | 597 if (track_buffer->stream()->supports_partial_append_window_trimming() && |
598 HandlePartialAppendWindowTrimming(append_window_start, | 598 HandlePartialAppendWindowTrimming(append_window_start, |
599 append_window_end, | 599 append_window_end, |
600 frame)) { | 600 frame)) { |
601 // If |frame| was front-trimmed a discontinuity may exist, so treat the | |
602 // next frames appended as if they were the beginning of a new media | |
603 // segment. | |
604 if (frame->timestamp() != presentation_timestamp && !sequence_mode_) | |
605 *new_media_segment = true; | |
606 | |
607 // |frame| has been partially trimmed or had preroll added. Though | 601 // |frame| has been partially trimmed or had preroll added. Though |
608 // |frame|'s duration may have changed, do not update |frame_duration| | 602 // |frame|'s duration may have changed, do not update |frame_duration| |
609 // here, so |track_buffer|'s last frame duration update uses original | 603 // here, so |track_buffer|'s last frame duration update uses original |
610 // frame duration and reduces spurious discontinuity detection. | 604 // frame duration and reduces spurious discontinuity detection. |
611 decode_timestamp = frame->GetDecodeTimestamp(); | 605 decode_timestamp = frame->GetDecodeTimestamp(); |
612 presentation_timestamp = frame->timestamp(); | 606 presentation_timestamp = frame->timestamp(); |
613 frame_end_timestamp = frame->timestamp() + frame->duration(); | 607 frame_end_timestamp = frame->timestamp() + frame->duration(); |
614 } | 608 } |
615 | 609 |
616 if (presentation_timestamp < append_window_start || | 610 if (presentation_timestamp < append_window_start || |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 695 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
702 | 696 |
703 return true; | 697 return true; |
704 } | 698 } |
705 | 699 |
706 NOTREACHED(); | 700 NOTREACHED(); |
707 return false; | 701 return false; |
708 } | 702 } |
709 | 703 |
710 } // namespace media | 704 } // namespace media |
OLD | NEW |