| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include <algorithm> // max | 10 #include <algorithm> // max |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return SEND_PACKET; | 532 return SEND_PACKET; |
| 533 } | 533 } |
| 534 } | 534 } |
| 535 | 535 |
| 536 accumulated_size_ += length; | 536 accumulated_size_ += length; |
| 537 | 537 |
| 538 if (use_fec_) | 538 if (use_fec_) |
| 539 TriggerLossReport(header); | 539 TriggerLossReport(header); |
| 540 | 540 |
| 541 if (test_generic_packetization_) { | 541 if (test_generic_packetization_) { |
| 542 size_t overhead = header.headerLength + header.paddingLength + | 542 size_t overhead = header.headerLength + header.paddingLength; |
| 543 (1 /* Generic header */); | 543 // Only remove payload header and RED header if the packet actually |
| 544 if (use_fec_) | 544 // contains payload. |
| 545 overhead += 1; // RED for FEC header. | 545 if (length > overhead) { |
| 546 overhead += (1 /* Generic header */); |
| 547 if (use_fec_) |
| 548 overhead += 1; // RED for FEC header. |
| 549 } |
| 550 EXPECT_GE(length, overhead); |
| 546 accumulated_payload_ += length - overhead; | 551 accumulated_payload_ += length - overhead; |
| 547 } | 552 } |
| 548 | 553 |
| 549 // Marker bit set indicates last packet of a frame. | 554 // Marker bit set indicates last packet of a frame. |
| 550 if (header.markerBit) { | 555 if (header.markerBit) { |
| 551 if (use_fec_ && accumulated_payload_ == current_size_rtp_ - 1) { | 556 if (use_fec_ && accumulated_payload_ == current_size_rtp_ - 1) { |
| 552 // With FEC enabled, frame size is incremented asynchronously, so | 557 // With FEC enabled, frame size is incremented asynchronously, so |
| 553 // "old" frames one byte too small may arrive. Accept, but don't | 558 // "old" frames one byte too small may arrive. Accept, but don't |
| 554 // increase expected frame size. | 559 // increase expected frame size. |
| 555 accumulated_size_ = 0; | 560 accumulated_size_ = 0; |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 RTPHeader header; | 1841 RTPHeader header; |
| 1837 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 1842 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
| 1838 | 1843 |
| 1839 if (header.payloadType == kVp9PayloadType) { | 1844 if (header.payloadType == kVp9PayloadType) { |
| 1840 RtpDepacketizerVp9 vp9depacketizer; | 1845 RtpDepacketizerVp9 vp9depacketizer; |
| 1841 RtpDepacketizer::ParsedPayload vp9payload; | 1846 RtpDepacketizer::ParsedPayload vp9payload; |
| 1842 const uint8_t* vp9_packet = packet + header.headerLength; | 1847 const uint8_t* vp9_packet = packet + header.headerLength; |
| 1843 size_t payload_length = | 1848 size_t payload_length = |
| 1844 length - header.headerLength - header.paddingLength; | 1849 length - header.headerLength - header.paddingLength; |
| 1845 | 1850 |
| 1846 bool parse_vp9header_successful = | 1851 if (payload_length > 0) { |
| 1847 vp9depacketizer.Parse(&vp9payload, vp9_packet, payload_length); | 1852 bool parse_vp9header_successful = |
| 1848 bool is_vp9_codec_type = | 1853 vp9depacketizer.Parse(&vp9payload, vp9_packet, payload_length); |
| 1849 vp9payload.type.Video.codec == RtpVideoCodecTypes::kRtpVideoVp9; | 1854 bool is_vp9_codec_type = |
| 1850 EXPECT_TRUE(parse_vp9header_successful); | 1855 vp9payload.type.Video.codec == RtpVideoCodecTypes::kRtpVideoVp9; |
| 1851 EXPECT_TRUE(is_vp9_codec_type); | 1856 EXPECT_TRUE(parse_vp9header_successful); |
| 1857 EXPECT_TRUE(is_vp9_codec_type); |
| 1852 | 1858 |
| 1853 RTPVideoHeaderVP9* vp9videoHeader = | 1859 RTPVideoHeaderVP9* vp9videoHeader = |
| 1854 &vp9payload.type.Video.codecHeader.VP9; | 1860 &vp9payload.type.Video.codecHeader.VP9; |
| 1855 if (parse_vp9header_successful && is_vp9_codec_type) { | 1861 if (parse_vp9header_successful && is_vp9_codec_type) { |
| 1856 InspectHeader(vp9videoHeader); | 1862 InspectHeader(vp9videoHeader); |
| 1857 } else { | 1863 } else { |
| 1858 observation_complete_->Set(); | 1864 observation_complete_->Set(); |
| 1865 } |
| 1859 } | 1866 } |
| 1860 } | 1867 } |
| 1861 | 1868 |
| 1862 return SEND_PACKET; | 1869 return SEND_PACKET; |
| 1863 } | 1870 } |
| 1864 | 1871 |
| 1865 protected: | 1872 protected: |
| 1866 rtc::scoped_ptr<VP9Encoder> vp9_encoder_; | 1873 rtc::scoped_ptr<VP9Encoder> vp9_encoder_; |
| 1867 VideoCodecVP9 vp9_settings_; | 1874 VideoCodecVP9 vp9_settings_; |
| 1868 }; | 1875 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1891 EXPECT_TRUE(vp9videoHeader->flexible_mode); | 1898 EXPECT_TRUE(vp9videoHeader->flexible_mode); |
| 1892 observation_complete_->Set(); | 1899 observation_complete_->Set(); |
| 1893 } | 1900 } |
| 1894 | 1901 |
| 1895 } test; | 1902 } test; |
| 1896 | 1903 |
| 1897 RunBaseTest(&test); | 1904 RunBaseTest(&test); |
| 1898 } | 1905 } |
| 1899 | 1906 |
| 1900 } // namespace webrtc | 1907 } // namespace webrtc |
| OLD | NEW |