Chromium Code Reviews| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 // We use base::TimeDelta instead of double. | 374 // We use base::TimeDelta instead of double. |
| 375 base::TimeDelta presentation_timestamp = frame->timestamp(); | 375 base::TimeDelta presentation_timestamp = frame->timestamp(); |
| 376 base::TimeDelta decode_timestamp = frame->GetDecodeTimestamp(); | 376 base::TimeDelta decode_timestamp = frame->GetDecodeTimestamp(); |
| 377 base::TimeDelta frame_duration = frame->duration(); | 377 base::TimeDelta frame_duration = frame->duration(); |
| 378 | 378 |
| 379 DVLOG(3) << __FUNCTION__ << ": Processing frame " | 379 DVLOG(3) << __FUNCTION__ << ": Processing frame " |
| 380 << "Type=" << frame->type() | 380 << "Type=" << frame->type() |
| 381 << ", TrackID=" << frame->track_id() | 381 << ", TrackID=" << frame->track_id() |
| 382 << ", PTS=" << presentation_timestamp.InSecondsF() | 382 << ", PTS=" << presentation_timestamp.InSecondsF() |
| 383 << ", DTS=" << decode_timestamp.InSecondsF() | 383 << ", DTS=" << decode_timestamp.InSecondsF() |
| 384 << ", DUR=" << frame_duration.InSecondsF(); | 384 << ", DUR=" << frame_duration.InSecondsF() |
| 385 << ", RAP=" << frame->IsKeyframe(); | |
| 385 | 386 |
| 386 // Sanity check the timestamps. | 387 // Sanity check the timestamps. |
| 387 if (presentation_timestamp == kNoTimestamp()) { | 388 if (presentation_timestamp == kNoTimestamp()) { |
| 388 DVLOG(2) << __FUNCTION__ << ": Unknown frame PTS"; | 389 DVLOG(2) << __FUNCTION__ << ": Unknown frame PTS"; |
| 389 return false; | 390 return false; |
| 390 } | 391 } |
| 391 if (decode_timestamp == kNoTimestamp()) { | 392 if (decode_timestamp == kNoTimestamp()) { |
| 392 DVLOG(2) << __FUNCTION__ << ": Unknown frame DTS"; | 393 DVLOG(2) << __FUNCTION__ << ": Unknown frame DTS"; |
| 393 return false; | 394 return false; |
| 394 } | 395 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 presentation_timestamp = frame->timestamp(); | 547 presentation_timestamp = frame->timestamp(); |
| 547 | 548 |
| 548 // The end timestamp of the frame should be unchanged. | 549 // The end timestamp of the frame should be unchanged. |
| 549 DCHECK(frame_end_timestamp == presentation_timestamp + frame->duration()); | 550 DCHECK(frame_end_timestamp == presentation_timestamp + frame->duration()); |
| 550 } | 551 } |
| 551 | 552 |
| 552 if (presentation_timestamp < append_window_start || | 553 if (presentation_timestamp < append_window_start || |
| 553 frame_end_timestamp > append_window_end) { | 554 frame_end_timestamp > append_window_end) { |
| 554 track_buffer->set_needs_random_access_point(true); | 555 track_buffer->set_needs_random_access_point(true); |
| 555 DVLOG(3) << "Dropping frame that is outside append window."; | 556 DVLOG(3) << "Dropping frame that is outside append window."; |
| 556 | |
| 557 if (!sequence_mode_) { | |
|
acolwell GONE FROM CHROMIUM
2014/07/08 16:32:00
This was causing broken behavior in ChunkDemuxerTe
wolenetz
2014/07/08 19:33:53
Ok. If enough frames are dropped such that a disco
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Yes. I believe that is the proper place for it. I
| |
| 558 // This also triggers a discontinuity so we need to treat the next | |
| 559 // frames appended within the append window as if they were the | |
| 560 // beginning of a new segment. | |
| 561 *new_media_segment = true; | |
| 562 } | |
| 563 | |
| 564 return true; | 557 return true; |
| 565 } | 558 } |
| 566 | 559 |
| 567 // Note: This step is relocated, versus April 1 spec, to allow append window | 560 // Note: This step is relocated, versus April 1 spec, to allow append window |
| 568 // processing to first filter coded frames shifted by |timestamp_offset_| in | 561 // processing to first filter coded frames shifted by |timestamp_offset_| in |
| 569 // such a way that their PTS is negative. | 562 // such a way that their PTS is negative. |
| 570 // 8. If the presentation timestamp or decode timestamp is less than the | 563 // 8. If the presentation timestamp or decode timestamp is less than the |
| 571 // presentation start time, then run the end of stream algorithm with the | 564 // presentation start time, then run the end of stream algorithm with the |
| 572 // error parameter set to "decode", and abort these steps. | 565 // error parameter set to "decode", and abort these steps. |
| 573 DCHECK(presentation_timestamp >= base::TimeDelta()); | 566 DCHECK(presentation_timestamp >= base::TimeDelta()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 634 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
| 642 | 635 |
| 643 return true; | 636 return true; |
| 644 } | 637 } |
| 645 | 638 |
| 646 NOTREACHED(); | 639 NOTREACHED(); |
| 647 return false; | 640 return false; |
| 648 } | 641 } |
| 649 | 642 |
| 650 } // namespace media | 643 } // namespace media |
| OLD | NEW |