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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 return result; | 326 return result; |
327 } | 327 } |
328 | 328 |
329 bool FrameProcessor::HandlePartialAppendWindowTrimming( | 329 bool FrameProcessor::HandlePartialAppendWindowTrimming( |
330 base::TimeDelta append_window_start, | 330 base::TimeDelta append_window_start, |
331 base::TimeDelta append_window_end, | 331 base::TimeDelta append_window_end, |
332 const scoped_refptr<StreamParserBuffer>& buffer) { | 332 const scoped_refptr<StreamParserBuffer>& buffer) { |
333 DCHECK(buffer->duration() > base::TimeDelta()); | 333 DCHECK(buffer->duration() > base::TimeDelta()); |
334 DCHECK_EQ(DemuxerStream::AUDIO, buffer->type()); | 334 DCHECK_EQ(DemuxerStream::AUDIO, buffer->type()); |
335 DCHECK(buffer->IsKeyframe()); | 335 DCHECK(buffer->is_keyframe()); |
336 | 336 |
337 const base::TimeDelta frame_end_timestamp = | 337 const base::TimeDelta frame_end_timestamp = |
338 buffer->timestamp() + buffer->duration(); | 338 buffer->timestamp() + buffer->duration(); |
339 | 339 |
340 // If the buffer is entirely before |append_window_start|, save it as preroll | 340 // If the buffer is entirely before |append_window_start|, save it as preroll |
341 // for the first buffer which overlaps |append_window_start|. | 341 // for the first buffer which overlaps |append_window_start|. |
342 if (buffer->timestamp() < append_window_start && | 342 if (buffer->timestamp() < append_window_start && |
343 frame_end_timestamp <= append_window_start) { | 343 frame_end_timestamp <= append_window_start) { |
344 audio_preroll_buffer_ = buffer; | 344 audio_preroll_buffer_ = buffer; |
345 return false; | 345 return false; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 base::TimeDelta presentation_timestamp = frame->timestamp(); | 439 base::TimeDelta presentation_timestamp = frame->timestamp(); |
440 DecodeTimestamp decode_timestamp = frame->GetDecodeTimestamp(); | 440 DecodeTimestamp decode_timestamp = frame->GetDecodeTimestamp(); |
441 base::TimeDelta frame_duration = frame->duration(); | 441 base::TimeDelta frame_duration = frame->duration(); |
442 | 442 |
443 DVLOG(3) << __FUNCTION__ << ": Processing frame " | 443 DVLOG(3) << __FUNCTION__ << ": Processing frame " |
444 << "Type=" << frame->type() | 444 << "Type=" << frame->type() |
445 << ", TrackID=" << frame->track_id() | 445 << ", TrackID=" << frame->track_id() |
446 << ", PTS=" << presentation_timestamp.InSecondsF() | 446 << ", PTS=" << presentation_timestamp.InSecondsF() |
447 << ", DTS=" << decode_timestamp.InSecondsF() | 447 << ", DTS=" << decode_timestamp.InSecondsF() |
448 << ", DUR=" << frame_duration.InSecondsF() | 448 << ", DUR=" << frame_duration.InSecondsF() |
449 << ", RAP=" << frame->IsKeyframe(); | 449 << ", RAP=" << frame->is_keyframe(); |
450 | 450 |
451 // Sanity check the timestamps. | 451 // Sanity check the timestamps. |
452 if (presentation_timestamp == kNoTimestamp()) { | 452 if (presentation_timestamp == kNoTimestamp()) { |
453 DVLOG(2) << __FUNCTION__ << ": Unknown frame PTS"; | 453 DVLOG(2) << __FUNCTION__ << ": Unknown frame PTS"; |
454 return false; | 454 return false; |
455 } | 455 } |
456 if (decode_timestamp == kNoDecodeTimestamp()) { | 456 if (decode_timestamp == kNoDecodeTimestamp()) { |
457 DVLOG(2) << __FUNCTION__ << ": Unknown frame DTS"; | 457 DVLOG(2) << __FUNCTION__ << ": Unknown frame DTS"; |
458 return false; | 458 return false; |
459 } | 459 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 << " and filtering against append window"; | 631 << " and filtering against append window"; |
632 return false; | 632 return false; |
633 } | 633 } |
634 | 634 |
635 // 12. If the need random access point flag on track buffer equals true, | 635 // 12. If the need random access point flag on track buffer equals true, |
636 // then run the following steps: | 636 // then run the following steps: |
637 if (track_buffer->needs_random_access_point()) { | 637 if (track_buffer->needs_random_access_point()) { |
638 // 12.1. If the coded frame is not a random access point, then drop the | 638 // 12.1. If the coded frame is not a random access point, then drop the |
639 // coded frame and jump to the top of the loop to start processing | 639 // coded frame and jump to the top of the loop to start processing |
640 // the next coded frame. | 640 // the next coded frame. |
641 if (!frame->IsKeyframe()) { | 641 if (!frame->is_keyframe()) { |
642 DVLOG(3) << __FUNCTION__ | 642 DVLOG(3) << __FUNCTION__ |
643 << ": Dropping frame that is not a random access point"; | 643 << ": Dropping frame that is not a random access point"; |
644 return true; | 644 return true; |
645 } | 645 } |
646 | 646 |
647 // 12.2. Set the need random access point flag on track buffer to false. | 647 // 12.2. Set the need random access point flag on track buffer to false. |
648 track_buffer->set_needs_random_access_point(false); | 648 track_buffer->set_needs_random_access_point(false); |
649 } | 649 } |
650 | 650 |
651 // We now have a processed buffer to append to the track buffer's stream. | 651 // We now have a processed buffer to append to the track buffer's stream. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 695 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
696 | 696 |
697 return true; | 697 return true; |
698 } | 698 } |
699 | 699 |
700 NOTREACHED(); | 700 NOTREACHED(); |
701 return false; | 701 return false; |
702 } | 702 } |
703 | 703 |
704 } // namespace media | 704 } // namespace media |
OLD | NEW |