| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "webrtc/test/field_trial.h" | 28 #include "webrtc/test/field_trial.h" |
| 29 | 29 |
| 30 namespace webrtc { | 30 namespace webrtc { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 const uint32_t kProcessIntervalSec = 60; | 33 const uint32_t kProcessIntervalSec = 60; |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 class Vp9SsMapTest : public ::testing::Test { | 36 class Vp9SsMapTest : public ::testing::Test { |
| 37 protected: | 37 protected: |
| 38 Vp9SsMapTest() : packet_(data_, 1400, 1234, 1, true) {} | 38 Vp9SsMapTest() : packet_() {} |
| 39 | 39 |
| 40 virtual void SetUp() { | 40 virtual void SetUp() { |
| 41 packet_.isFirstPacket = true; | 41 packet_.isFirstPacket = true; |
| 42 packet_.dataPtr = data_; |
| 43 packet_.sizeBytes = 1400; |
| 44 packet_.seqNum = 1234; |
| 45 packet_.timestamp = 1; |
| 42 packet_.markerBit = true; | 46 packet_.markerBit = true; |
| 43 packet_.frameType = kVideoFrameKey; | 47 packet_.frameType = kVideoFrameKey; |
| 44 packet_.codec = kVideoCodecVP9; | 48 packet_.codec = kVideoCodecVP9; |
| 45 packet_.video_header.codec = kRtpVideoVp9; | 49 packet_.video_header.codec = kRtpVideoVp9; |
| 46 packet_.video_header.codecHeader.VP9.flexible_mode = false; | 50 packet_.video_header.codecHeader.VP9.flexible_mode = false; |
| 47 packet_.video_header.codecHeader.VP9.gof_idx = 0; | 51 packet_.video_header.codecHeader.VP9.gof_idx = 0; |
| 48 packet_.video_header.codecHeader.VP9.temporal_idx = kNoTemporalIdx; | 52 packet_.video_header.codecHeader.VP9.temporal_idx = kNoTemporalIdx; |
| 49 packet_.video_header.codecHeader.VP9.temporal_up_switch = false; | 53 packet_.video_header.codecHeader.VP9.temporal_up_switch = false; |
| 50 packet_.video_header.codecHeader.VP9.ss_data_available = true; | 54 packet_.video_header.codecHeader.VP9.ss_data_available = true; |
| 51 packet_.video_header.codecHeader.VP9.gof.SetGofInfoVP9( | 55 packet_.video_header.codecHeader.VP9.gof.SetGofInfoVP9( |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 data_[i] = count; | 239 data_[i] = count; |
| 236 count++; | 240 count++; |
| 237 if (count == 10) { | 241 if (count == 10) { |
| 238 data_[i + 1] = 0; | 242 data_[i + 1] = 0; |
| 239 data_[i + 2] = 0; | 243 data_[i + 2] = 0; |
| 240 data_[i + 3] = 0x80; | 244 data_[i + 3] = 0x80; |
| 241 count = 3; | 245 count = 3; |
| 242 i += 3; | 246 i += 3; |
| 243 } | 247 } |
| 244 } | 248 } |
| 245 packet_.reset(new VCMPacket(data_, size_, seq_num_, timestamp_, true)); | 249 WebRtcRTPHeader rtpHeader; |
| 250 memset(&rtpHeader, 0, sizeof(rtpHeader)); |
| 251 rtpHeader.header.sequenceNumber = seq_num_; |
| 252 rtpHeader.header.timestamp = timestamp_; |
| 253 rtpHeader.header.markerBit = true; |
| 254 rtpHeader.frameType = kVideoFrameDelta; |
| 255 packet_.reset(new VCMPacket(data_, size_, rtpHeader)); |
| 246 } | 256 } |
| 247 | 257 |
| 248 VCMEncodedFrame* DecodeCompleteFrame() { | 258 VCMEncodedFrame* DecodeCompleteFrame() { |
| 249 VCMEncodedFrame* found_frame = jitter_buffer_->NextCompleteFrame(10); | 259 VCMEncodedFrame* found_frame = jitter_buffer_->NextCompleteFrame(10); |
| 250 if (!found_frame) | 260 if (!found_frame) |
| 251 return nullptr; | 261 return nullptr; |
| 252 return jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp()); | 262 return jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp()); |
| 253 } | 263 } |
| 254 | 264 |
| 255 VCMEncodedFrame* DecodeIncompleteFrame() { | 265 VCMEncodedFrame* DecodeIncompleteFrame() { |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 frame_out = DecodeCompleteFrame(); | 813 frame_out = DecodeCompleteFrame(); |
| 804 EXPECT_TRUE(frame_out != NULL); | 814 EXPECT_TRUE(frame_out != NULL); |
| 805 jitter_buffer_->ReleaseFrame(frame_out); | 815 jitter_buffer_->ReleaseFrame(frame_out); |
| 806 | 816 |
| 807 // But Frame C isn't continuous yet. | 817 // But Frame C isn't continuous yet. |
| 808 frame_out = DecodeCompleteFrame(); | 818 frame_out = DecodeCompleteFrame(); |
| 809 EXPECT_TRUE(frame_out == NULL); | 819 EXPECT_TRUE(frame_out == NULL); |
| 810 | 820 |
| 811 // Add in the padding. These are empty packets (data length is 0) with no | 821 // Add in the padding. These are empty packets (data length is 0) with no |
| 812 // marker bit and matching the timestamp of Frame B. | 822 // marker bit and matching the timestamp of Frame B. |
| 813 VCMPacket empty_packet(data_, 0, seq_num_ + 2, timestamp_ + (33 * 90), false); | 823 WebRtcRTPHeader rtpHeader; |
| 824 memset(&rtpHeader, 0, sizeof(rtpHeader)); |
| 825 rtpHeader.header.sequenceNumber = seq_num_ + 2; |
| 826 rtpHeader.header.timestamp = timestamp_ + (33 * 90); |
| 827 rtpHeader.header.markerBit = false; |
| 828 VCMPacket empty_packet(data_, 0, rtpHeader); |
| 814 EXPECT_EQ(kOldPacket, | 829 EXPECT_EQ(kOldPacket, |
| 815 jitter_buffer_->InsertPacket(empty_packet, &retransmitted)); | 830 jitter_buffer_->InsertPacket(empty_packet, &retransmitted)); |
| 816 empty_packet.seqNum += 1; | 831 empty_packet.seqNum += 1; |
| 817 EXPECT_EQ(kOldPacket, | 832 EXPECT_EQ(kOldPacket, |
| 818 jitter_buffer_->InsertPacket(empty_packet, &retransmitted)); | 833 jitter_buffer_->InsertPacket(empty_packet, &retransmitted)); |
| 819 | 834 |
| 820 // But now Frame C should be ready! | 835 // But now Frame C should be ready! |
| 821 frame_out = DecodeCompleteFrame(); | 836 frame_out = DecodeCompleteFrame(); |
| 822 EXPECT_TRUE(frame_out != NULL); | 837 EXPECT_TRUE(frame_out != NULL); |
| 823 jitter_buffer_->ReleaseFrame(frame_out); | 838 jitter_buffer_->ReleaseFrame(frame_out); |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 // This packet should not be decoded because it is an incomplete NAL if it | 2096 // This packet should not be decoded because it is an incomplete NAL if it |
| 2082 // is the last. | 2097 // is the last. |
| 2083 frame_out = DecodeIncompleteFrame(); | 2098 frame_out = DecodeIncompleteFrame(); |
| 2084 // Only last NALU is complete. | 2099 // Only last NALU is complete. |
| 2085 CheckOutFrame(frame_out, insertedLength, false); | 2100 CheckOutFrame(frame_out, insertedLength, false); |
| 2086 jitter_buffer_->ReleaseFrame(frame_out); | 2101 jitter_buffer_->ReleaseFrame(frame_out); |
| 2087 | 2102 |
| 2088 // Test to insert empty packet. | 2103 // Test to insert empty packet. |
| 2089 seq_num_++; | 2104 seq_num_++; |
| 2090 timestamp_ += 33 * 90; | 2105 timestamp_ += 33 * 90; |
| 2091 VCMPacket emptypacket(data_, 0, seq_num_, timestamp_, true); | 2106 WebRtcRTPHeader rtpHeader; |
| 2107 memset(&rtpHeader, 0, sizeof(rtpHeader)); |
| 2108 VCMPacket emptypacket(data_, 0, rtpHeader); |
| 2092 emptypacket.seqNum = seq_num_; | 2109 emptypacket.seqNum = seq_num_; |
| 2093 emptypacket.timestamp = timestamp_; | 2110 emptypacket.timestamp = timestamp_; |
| 2094 emptypacket.frameType = kVideoFrameKey; | 2111 emptypacket.frameType = kVideoFrameKey; |
| 2095 emptypacket.isFirstPacket = true; | 2112 emptypacket.isFirstPacket = true; |
| 2096 emptypacket.completeNALU = kNaluComplete; | 2113 emptypacket.completeNALU = kNaluComplete; |
| 2097 emptypacket.markerBit = true; | 2114 emptypacket.markerBit = true; |
| 2098 EXPECT_EQ(kCompleteSession, | 2115 EXPECT_EQ(kCompleteSession, |
| 2099 jitter_buffer_->InsertPacket(emptypacket, &retransmitted)); | 2116 jitter_buffer_->InsertPacket(emptypacket, &retransmitted)); |
| 2100 // This packet should not be decoded because it is an incomplete NAL if it | 2117 // This packet should not be decoded because it is an incomplete NAL if it |
| 2101 // is the last. | 2118 // is the last. |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 | 2675 |
| 2659 // Stream should be decodable from this point. | 2676 // Stream should be decodable from this point. |
| 2660 clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs); | 2677 clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs); |
| 2661 InsertFrame(kVideoFrameDelta); | 2678 InsertFrame(kVideoFrameDelta); |
| 2662 EXPECT_TRUE(DecodeCompleteFrame()); | 2679 EXPECT_TRUE(DecodeCompleteFrame()); |
| 2663 nack_list = jitter_buffer_->GetNackList(&extended); | 2680 nack_list = jitter_buffer_->GetNackList(&extended); |
| 2664 EXPECT_EQ(0u, nack_list.size()); | 2681 EXPECT_EQ(0u, nack_list.size()); |
| 2665 } | 2682 } |
| 2666 | 2683 |
| 2667 } // namespace webrtc | 2684 } // namespace webrtc |
| OLD | NEW |