| 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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 | 1827 |
| 1828 TEST_F(TestBasicJitterBuffer, ExceedNumOfFrameWithSeqNumWrap) { | 1828 TEST_F(TestBasicJitterBuffer, ExceedNumOfFrameWithSeqNumWrap) { |
| 1829 // TEST fill JB with more than max number of frame (50 delta frames + | 1829 // TEST fill JB with more than max number of frame (50 delta frames + |
| 1830 // 51 key frames) with wrap in seq_num_ | 1830 // 51 key frames) with wrap in seq_num_ |
| 1831 // | 1831 // |
| 1832 // -------------------------------------------------------------- | 1832 // -------------------------------------------------------------- |
| 1833 // | 65485 | 65486 | 65487 | .... | 65535 | 0 | 1 | 2 | .....| 50 | | 1833 // | 65485 | 65486 | 65487 | .... | 65535 | 0 | 1 | 2 | .....| 50 | |
| 1834 // -------------------------------------------------------------- | 1834 // -------------------------------------------------------------- |
| 1835 // |<-----------delta frames------------->|<------key frames----->| | 1835 // |<-----------delta frames------------->|<------key frames----->| |
| 1836 | 1836 |
| 1837 // Make sure the jitter doesn't request a keyframe after too much non- |
| 1838 // decodable frames. |
| 1839 jitter_buffer_->SetNackMode(kNack, -1, -1); |
| 1840 jitter_buffer_->SetNackSettings(kMaxNumberOfFrames, |
| 1841 kMaxNumberOfFrames, 0); |
| 1842 |
| 1837 int loop = 0; | 1843 int loop = 0; |
| 1838 seq_num_ = 65485; | 1844 seq_num_ = 65485; |
| 1839 uint32_t first_key_frame_timestamp = 0; | 1845 uint32_t first_key_frame_timestamp = 0; |
| 1840 bool retransmitted = false; | 1846 bool retransmitted = false; |
| 1841 // Insert MAX_NUMBER_OF_FRAMES frames. | 1847 // Insert MAX_NUMBER_OF_FRAMES frames. |
| 1842 do { | 1848 do { |
| 1843 timestamp_ += 33*90; | 1849 timestamp_ += 33*90; |
| 1844 seq_num_++; | 1850 seq_num_++; |
| 1845 packet_->isFirstPacket = true; | 1851 packet_->isFirstPacket = true; |
| 1846 packet_->markerBit = true; | 1852 packet_->markerBit = true; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 | 2130 |
| 2125 EXPECT_EQ(kDecodableSession, jitter_buffer_->InsertPacket(*packet_, | 2131 EXPECT_EQ(kDecodableSession, jitter_buffer_->InsertPacket(*packet_, |
| 2126 &retransmitted)); | 2132 &retransmitted)); |
| 2127 | 2133 |
| 2128 frame_out = DecodeIncompleteFrame(); | 2134 frame_out = DecodeIncompleteFrame(); |
| 2129 CheckOutFrame(frame_out, packet_->sizeBytes, false); | 2135 CheckOutFrame(frame_out, packet_->sizeBytes, false); |
| 2130 jitter_buffer_->ReleaseFrame(frame_out); | 2136 jitter_buffer_->ReleaseFrame(frame_out); |
| 2131 } | 2137 } |
| 2132 | 2138 |
| 2133 TEST_F(TestRunningJitterBuffer, Full) { | 2139 TEST_F(TestRunningJitterBuffer, Full) { |
| 2140 // Make sure the jitter doesn't request a keyframe after too much non- |
| 2141 // decodable frames. |
| 2142 jitter_buffer_->SetNackMode(kNack, -1, -1); |
| 2143 jitter_buffer_->SetNackSettings(kMaxNumberOfFrames, |
| 2144 kMaxNumberOfFrames, 0); |
| 2134 // Insert a key frame and decode it. | 2145 // Insert a key frame and decode it. |
| 2135 EXPECT_GE(InsertFrame(kVideoFrameKey), kNoError); | 2146 EXPECT_GE(InsertFrame(kVideoFrameKey), kNoError); |
| 2136 EXPECT_TRUE(DecodeCompleteFrame()); | 2147 EXPECT_TRUE(DecodeCompleteFrame()); |
| 2137 DropFrame(1); | 2148 DropFrame(1); |
| 2138 // Fill the jitter buffer. | 2149 // Fill the jitter buffer. |
| 2139 EXPECT_GE(InsertFrames(kMaxNumberOfFrames, kVideoFrameDelta), kNoError); | 2150 EXPECT_GE(InsertFrames(kMaxNumberOfFrames, kVideoFrameDelta), kNoError); |
| 2140 // Make sure we can't decode these frames. | 2151 // Make sure we can't decode these frames. |
| 2141 EXPECT_FALSE(DecodeCompleteFrame()); | 2152 EXPECT_FALSE(DecodeCompleteFrame()); |
| 2142 // This frame will make the jitter buffer recycle frames until a key frame. | 2153 // This frame will make the jitter buffer recycle frames until a key frame. |
| 2143 // Since none is found it will have to wait until the next key frame before | 2154 // Since none is found it will have to wait until the next key frame before |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 | 2579 |
| 2569 // Stream should be decodable from this point. | 2580 // Stream should be decodable from this point. |
| 2570 clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs); | 2581 clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs); |
| 2571 InsertFrame(kVideoFrameDelta); | 2582 InsertFrame(kVideoFrameDelta); |
| 2572 EXPECT_TRUE(DecodeCompleteFrame()); | 2583 EXPECT_TRUE(DecodeCompleteFrame()); |
| 2573 nack_list = jitter_buffer_->GetNackList(&extended); | 2584 nack_list = jitter_buffer_->GetNackList(&extended); |
| 2574 EXPECT_EQ(0u, nack_list.size()); | 2585 EXPECT_EQ(0u, nack_list.size()); |
| 2575 } | 2586 } |
| 2576 | 2587 |
| 2577 } // namespace webrtc | 2588 } // namespace webrtc |
| OLD | NEW |