OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 input_frame_.reset( | 154 input_frame_.reset( |
155 new VideoFrame(stride_buffer, kVideoRotation_0, 0)); | 155 new VideoFrame(stride_buffer, kVideoRotation_0, 0)); |
156 input_frame_->set_timestamp(kTestTimestamp); | 156 input_frame_->set_timestamp(kTestTimestamp); |
157 } | 157 } |
158 | 158 |
159 void SetUpEncodeDecode() { | 159 void SetUpEncodeDecode() { |
160 codec_inst_.startBitrate = 300; | 160 codec_inst_.startBitrate = 300; |
161 codec_inst_.maxBitrate = 4000; | 161 codec_inst_.maxBitrate = 4000; |
162 codec_inst_.qpMax = 56; | 162 codec_inst_.qpMax = 56; |
163 codec_inst_.codecSpecific.VP8.denoisingOn = true; | 163 codec_inst_.VP8()->denoisingOn = true; |
164 | 164 |
165 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 165 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
166 encoder_->InitEncode(&codec_inst_, 1, 1440)); | 166 encoder_->InitEncode(&codec_inst_, 1, 1440)); |
167 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); | 167 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); |
168 } | 168 } |
169 | 169 |
170 size_t WaitForEncodedFrame() const { | 170 size_t WaitForEncodedFrame() const { |
171 int64_t startTime = rtc::TimeMillis(); | 171 int64_t startTime = rtc::TimeMillis(); |
172 while (rtc::TimeMillis() - startTime < kMaxWaitEncTimeMs) { | 172 while (rtc::TimeMillis() - startTime < kMaxWaitEncTimeMs) { |
173 if (encode_complete_callback_->EncodeComplete()) { | 173 if (encode_complete_callback_->EncodeComplete()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 TEST_F(TestVp8Impl, EncoderParameterTest) { | 206 TEST_F(TestVp8Impl, EncoderParameterTest) { |
207 strncpy(codec_inst_.plName, "VP8", 31); | 207 strncpy(codec_inst_.plName, "VP8", 31); |
208 codec_inst_.plType = 126; | 208 codec_inst_.plType = 126; |
209 codec_inst_.maxBitrate = 0; | 209 codec_inst_.maxBitrate = 0; |
210 codec_inst_.minBitrate = 0; | 210 codec_inst_.minBitrate = 0; |
211 codec_inst_.width = 1440; | 211 codec_inst_.width = 1440; |
212 codec_inst_.height = 1080; | 212 codec_inst_.height = 1080; |
213 codec_inst_.maxFramerate = 30; | 213 codec_inst_.maxFramerate = 30; |
214 codec_inst_.startBitrate = 300; | 214 codec_inst_.startBitrate = 300; |
215 codec_inst_.qpMax = 56; | 215 codec_inst_.qpMax = 56; |
216 codec_inst_.codecSpecific.VP8.complexity = kComplexityNormal; | 216 codec_inst_.VP8()->complexity = kComplexityNormal; |
217 codec_inst_.codecSpecific.VP8.numberOfTemporalLayers = 1; | 217 codec_inst_.VP8()->numberOfTemporalLayers = 1; |
218 // Calls before InitEncode(). | 218 // Calls before InitEncode(). |
219 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); | 219 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); |
220 int bit_rate = 300; | 220 int bit_rate = 300; |
221 EXPECT_EQ(WEBRTC_VIDEO_CODEC_UNINITIALIZED, | 221 EXPECT_EQ(WEBRTC_VIDEO_CODEC_UNINITIALIZED, |
222 encoder_->SetRates(bit_rate, codec_inst_.maxFramerate)); | 222 encoder_->SetRates(bit_rate, codec_inst_.maxFramerate)); |
223 | 223 |
224 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_inst_, 1, 1440)); | 224 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_inst_, 1, 1440)); |
225 | 225 |
226 // Decoder parameter tests. | 226 // Decoder parameter tests. |
227 // Calls before InitDecode(). | 227 // Calls before InitDecode(). |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 269 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
270 decoder_->Decode(encoded_frame_, false, NULL)); | 270 decoder_->Decode(encoded_frame_, false, NULL)); |
271 // Now setting a key frame. | 271 // Now setting a key frame. |
272 encoded_frame_._frameType = kVideoFrameKey; | 272 encoded_frame_._frameType = kVideoFrameKey; |
273 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 273 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
274 decoder_->Decode(encoded_frame_, false, NULL)); | 274 decoder_->Decode(encoded_frame_, false, NULL)); |
275 EXPECT_GT(I420PSNR(input_frame_.get(), &decoded_frame_), 36); | 275 EXPECT_GT(I420PSNR(input_frame_.get(), &decoded_frame_), 36); |
276 } | 276 } |
277 | 277 |
278 } // namespace webrtc | 278 } // namespace webrtc |
OLD | NEW |