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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 | 10 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 // processing. | 558 // processing. |
| 559 presentation_timestamp += *timestamp_offset; | 559 presentation_timestamp += *timestamp_offset; |
| 560 | 560 |
| 561 // 4.2. Add timestampOffset to the decode timestamp. | 561 // 4.2. Add timestampOffset to the decode timestamp. |
| 562 // Frame DTS is only updated if it survives discontinuity processing. | 562 // Frame DTS is only updated if it survives discontinuity processing. |
| 563 decode_timestamp += *timestamp_offset; | 563 decode_timestamp += *timestamp_offset; |
| 564 } | 564 } |
| 565 | 565 |
| 566 // 5. Let track buffer equal the track buffer that the coded frame will be | 566 // 5. Let track buffer equal the track buffer that the coded frame will be |
| 567 // added to. | 567 // added to. |
| 568 | 568 StreamParser::TrackId track_id = frame->track_id(); |
|
wolenetz
2016/09/13 21:03:13
aside: WOOT! :)
servolk
2016/09/14 18:15:25
Acknowledged.
| |
| 569 // Remap audio and video track types to their special singleton identifiers. | |
| 570 StreamParser::TrackId track_id = kAudioTrackId; | |
| 571 switch (frame->type()) { | |
| 572 case DemuxerStream::AUDIO: | |
| 573 break; | |
| 574 case DemuxerStream::VIDEO: | |
| 575 track_id = kVideoTrackId; | |
| 576 break; | |
| 577 case DemuxerStream::TEXT: | |
| 578 track_id = frame->track_id(); | |
| 579 break; | |
| 580 case DemuxerStream::UNKNOWN: | |
| 581 case DemuxerStream::NUM_TYPES: | |
| 582 DCHECK(false) << ": Invalid frame type " << frame->type(); | |
| 583 return false; | |
| 584 } | |
| 585 | |
| 586 MseTrackBuffer* track_buffer = FindTrack(track_id); | 569 MseTrackBuffer* track_buffer = FindTrack(track_id); |
| 587 if (!track_buffer) { | 570 if (!track_buffer) { |
| 588 MEDIA_LOG(ERROR, media_log_) | 571 MEDIA_LOG(ERROR, media_log_) |
| 589 << "Unknown track with type " << frame->GetTypeName() | 572 << "Unknown track with type " << frame->GetTypeName() |
| 590 << ", frame processor track id " << track_id | 573 << ", frame processor track id " << track_id |
| 591 << ", and parser track id " << frame->track_id(); | 574 << ", and parser track id " << frame->track_id(); |
| 592 return false; | 575 return false; |
| 593 } | 576 } |
| 577 if (frame->type() != track_buffer->stream()->type()) { | |
| 578 MEDIA_LOG(ERROR, media_log_) << "Frame type " << frame->GetTypeName() | |
| 579 << " doesn't match track buffer type " | |
| 580 << track_buffer->stream()->type(); | |
| 581 return false; | |
| 582 } | |
| 594 | 583 |
| 595 // 6. If last decode timestamp for track buffer is set and decode timestamp | 584 // 6. If last decode timestamp for track buffer is set and decode timestamp |
| 596 // is less than last decode timestamp | 585 // is less than last decode timestamp |
| 597 // OR | 586 // OR |
| 598 // If last decode timestamp for track buffer is set and the difference | 587 // If last decode timestamp for track buffer is set and the difference |
| 599 // between decode timestamp and last decode timestamp is greater than 2 | 588 // between decode timestamp and last decode timestamp is greater than 2 |
| 600 // times last frame duration: | 589 // times last frame duration: |
| 601 DecodeTimestamp track_last_decode_timestamp = | 590 DecodeTimestamp track_last_decode_timestamp = |
| 602 track_buffer->last_decode_timestamp(); | 591 track_buffer->last_decode_timestamp(); |
| 603 if (track_last_decode_timestamp != kNoDecodeTimestamp()) { | 592 if (track_last_decode_timestamp != kNoDecodeTimestamp()) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 // Step 21 is currently handled differently. See MediaSourceState's | 746 // Step 21 is currently handled differently. See MediaSourceState's |
| 758 // |auto_update_timestamp_offset_|. | 747 // |auto_update_timestamp_offset_|. |
| 759 return true; | 748 return true; |
| 760 } | 749 } |
| 761 | 750 |
| 762 NOTREACHED(); | 751 NOTREACHED(); |
| 763 return false; | 752 return false; |
| 764 } | 753 } |
| 765 | 754 |
| 766 } // namespace media | 755 } // namespace media |
| OLD | NEW |