Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: webrtc/modules/video_coding/main/source/video_receiver_unittest.cc

Issue 1371043003: Unify FrameType and VideoFrameType. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 }; 81 };
82 82
83 TEST_F(TestVideoReceiver, PaddingOnlyFrames) { 83 TEST_F(TestVideoReceiver, PaddingOnlyFrames) {
84 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); 84 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true));
85 EXPECT_EQ( 85 EXPECT_EQ(
86 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); 86 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_));
87 const size_t kPaddingSize = 220; 87 const size_t kPaddingSize = 220;
88 const uint8_t payload[kPaddingSize] = {0}; 88 const uint8_t payload[kPaddingSize] = {0};
89 WebRtcRTPHeader header; 89 WebRtcRTPHeader header;
90 memset(&header, 0, sizeof(header)); 90 memset(&header, 0, sizeof(header));
91 header.frameType = kFrameEmpty; 91 header.frameType = kEmptyFrame;
92 header.header.markerBit = false; 92 header.header.markerBit = false;
93 header.header.paddingLength = kPaddingSize; 93 header.header.paddingLength = kPaddingSize;
94 header.header.payloadType = kUnusedPayloadType; 94 header.header.payloadType = kUnusedPayloadType;
95 header.header.ssrc = 1; 95 header.header.ssrc = 1;
96 header.header.headerLength = 12; 96 header.header.headerLength = 12;
97 header.type.Video.codec = kRtpVideoVp8; 97 header.type.Video.codec = kRtpVideoVp8;
98 for (int i = 0; i < 10; ++i) { 98 for (int i = 0; i < 10; ++i) {
99 EXPECT_CALL(packet_request_callback_, ResendPackets(_, _)).Times(0); 99 EXPECT_CALL(packet_request_callback_, ResendPackets(_, _)).Times(0);
100 InsertAndVerifyPaddingFrame(payload, &header); 100 InsertAndVerifyPaddingFrame(payload, &header);
101 clock_.AdvanceTimeMilliseconds(33); 101 clock_.AdvanceTimeMilliseconds(33);
102 header.header.timestamp += 3000; 102 header.header.timestamp += 3000;
103 } 103 }
104 } 104 }
105 105
106 TEST_F(TestVideoReceiver, PaddingOnlyFramesWithLosses) { 106 TEST_F(TestVideoReceiver, PaddingOnlyFramesWithLosses) {
107 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); 107 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true));
108 EXPECT_EQ( 108 EXPECT_EQ(
109 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); 109 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_));
110 const size_t kFrameSize = 1200; 110 const size_t kFrameSize = 1200;
111 const size_t kPaddingSize = 220; 111 const size_t kPaddingSize = 220;
112 const uint8_t payload[kFrameSize] = {0}; 112 const uint8_t payload[kFrameSize] = {0};
113 WebRtcRTPHeader header; 113 WebRtcRTPHeader header;
114 memset(&header, 0, sizeof(header)); 114 memset(&header, 0, sizeof(header));
115 header.frameType = kFrameEmpty; 115 header.frameType = kEmptyFrame;
116 header.header.markerBit = false; 116 header.header.markerBit = false;
117 header.header.paddingLength = kPaddingSize; 117 header.header.paddingLength = kPaddingSize;
118 header.header.payloadType = kUnusedPayloadType; 118 header.header.payloadType = kUnusedPayloadType;
119 header.header.ssrc = 1; 119 header.header.ssrc = 1;
120 header.header.headerLength = 12; 120 header.header.headerLength = 12;
121 header.type.Video.codec = kRtpVideoVp8; 121 header.type.Video.codec = kRtpVideoVp8;
122 // Insert one video frame to get one frame decoded. 122 // Insert one video frame to get one frame decoded.
123 header.frameType = kVideoFrameKey; 123 header.frameType = kVideoFrameKey;
124 header.type.Video.isFirstPacket = true; 124 header.type.Video.isFirstPacket = true;
125 header.header.markerBit = true; 125 header.header.markerBit = true;
126 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); 126 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header);
127 clock_.AdvanceTimeMilliseconds(33); 127 clock_.AdvanceTimeMilliseconds(33);
128 header.header.timestamp += 3000; 128 header.header.timestamp += 3000;
129 129
130 header.frameType = kFrameEmpty; 130 header.frameType = kEmptyFrame;
131 header.type.Video.isFirstPacket = false; 131 header.type.Video.isFirstPacket = false;
132 header.header.markerBit = false; 132 header.header.markerBit = false;
133 // Insert padding frames. 133 // Insert padding frames.
134 for (int i = 0; i < 10; ++i) { 134 for (int i = 0; i < 10; ++i) {
135 // Lose one packet from the 6th frame. 135 // Lose one packet from the 6th frame.
136 if (i == 5) { 136 if (i == 5) {
137 ++header.header.sequenceNumber; 137 ++header.header.sequenceNumber;
138 } 138 }
139 // Lose the 4th frame. 139 // Lose the 4th frame.
140 if (i == 3) { 140 if (i == 3) {
(...skipping 15 matching lines...) Expand all
156 156
157 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { 157 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) {
158 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); 158 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true));
159 EXPECT_EQ( 159 EXPECT_EQ(
160 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); 160 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_));
161 const size_t kFrameSize = 1200; 161 const size_t kFrameSize = 1200;
162 const size_t kPaddingSize = 220; 162 const size_t kPaddingSize = 220;
163 const uint8_t payload[kFrameSize] = {0}; 163 const uint8_t payload[kFrameSize] = {0};
164 WebRtcRTPHeader header; 164 WebRtcRTPHeader header;
165 memset(&header, 0, sizeof(header)); 165 memset(&header, 0, sizeof(header));
166 header.frameType = kFrameEmpty; 166 header.frameType = kEmptyFrame;
167 header.type.Video.isFirstPacket = false; 167 header.type.Video.isFirstPacket = false;
168 header.header.markerBit = false; 168 header.header.markerBit = false;
169 header.header.paddingLength = kPaddingSize; 169 header.header.paddingLength = kPaddingSize;
170 header.header.payloadType = kUnusedPayloadType; 170 header.header.payloadType = kUnusedPayloadType;
171 header.header.ssrc = 1; 171 header.header.ssrc = 1;
172 header.header.headerLength = 12; 172 header.header.headerLength = 12;
173 header.type.Video.codec = kRtpVideoVp8; 173 header.type.Video.codec = kRtpVideoVp8;
174 header.type.Video.codecHeader.VP8.pictureId = -1; 174 header.type.Video.codecHeader.VP8.pictureId = -1;
175 header.type.Video.codecHeader.VP8.tl0PicIdx = -1; 175 header.type.Video.codecHeader.VP8.tl0PicIdx = -1;
176 for (int i = 0; i < 3; ++i) { 176 for (int i = 0; i < 3; ++i) {
177 // Insert 2 video frames. 177 // Insert 2 video frames.
178 for (int j = 0; j < 2; ++j) { 178 for (int j = 0; j < 2; ++j) {
179 if (i == 0 && j == 0) // First frame should be a key frame. 179 if (i == 0 && j == 0) // First frame should be a key frame.
180 header.frameType = kVideoFrameKey; 180 header.frameType = kVideoFrameKey;
181 else 181 else
182 header.frameType = kVideoFrameDelta; 182 header.frameType = kVideoFrameDelta;
183 header.type.Video.isFirstPacket = true; 183 header.type.Video.isFirstPacket = true;
184 header.header.markerBit = true; 184 header.header.markerBit = true;
185 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); 185 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header);
186 clock_.AdvanceTimeMilliseconds(33); 186 clock_.AdvanceTimeMilliseconds(33);
187 header.header.timestamp += 3000; 187 header.header.timestamp += 3000;
188 } 188 }
189 189
190 // Insert 2 padding only frames. 190 // Insert 2 padding only frames.
191 header.frameType = kFrameEmpty; 191 header.frameType = kEmptyFrame;
192 header.type.Video.isFirstPacket = false; 192 header.type.Video.isFirstPacket = false;
193 header.header.markerBit = false; 193 header.header.markerBit = false;
194 for (int j = 0; j < 2; ++j) { 194 for (int j = 0; j < 2; ++j) {
195 // InsertAndVerifyPaddingFrame(payload, &header); 195 // InsertAndVerifyPaddingFrame(payload, &header);
196 clock_.AdvanceTimeMilliseconds(33); 196 clock_.AdvanceTimeMilliseconds(33);
197 header.header.timestamp += 3000; 197 header.header.timestamp += 3000;
198 } 198 }
199 } 199 }
200 } 200 }
201 201
202 TEST_F(TestVideoReceiver, ReceiverDelay) { 202 TEST_F(TestVideoReceiver, ReceiverDelay) {
203 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); 203 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0));
204 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); 204 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000));
205 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); 205 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100));
206 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); 206 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010));
207 } 207 }
208 208
209 } // namespace 209 } // namespace
210 } // namespace vcm 210 } // namespace vcm
211 } // namespace webrtc 211 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698