| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Calls before InitDecode(). | 214 // Calls before InitDecode(). |
| 215 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); | 215 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); |
| 216 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); | 216 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(AlignedStrideEncodeDecode)) { | 219 TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(AlignedStrideEncodeDecode)) { |
| 220 SetUpEncodeDecode(); | 220 SetUpEncodeDecode(); |
| 221 encoder_->Encode(input_frame_, NULL, NULL); | 221 encoder_->Encode(input_frame_, NULL, NULL); |
| 222 EXPECT_GT(WaitForEncodedFrame(), 0u); | 222 EXPECT_GT(WaitForEncodedFrame(), 0u); |
| 223 // First frame should be a key frame. | 223 // First frame should be a key frame. |
| 224 encoded_frame_._frameType = kKeyFrame; | 224 encoded_frame_._frameType = kVideoFrameKey; |
| 225 encoded_frame_.ntp_time_ms_ = kTestNtpTimeMs; | 225 encoded_frame_.ntp_time_ms_ = kTestNtpTimeMs; |
| 226 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 226 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 227 decoder_->Decode(encoded_frame_, false, NULL)); | 227 decoder_->Decode(encoded_frame_, false, NULL)); |
| 228 EXPECT_GT(WaitForDecodedFrame(), 0u); | 228 EXPECT_GT(WaitForDecodedFrame(), 0u); |
| 229 // Compute PSNR on all planes (faster than SSIM). | 229 // Compute PSNR on all planes (faster than SSIM). |
| 230 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); | 230 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); |
| 231 EXPECT_EQ(kTestTimestamp, decoded_frame_.timestamp()); | 231 EXPECT_EQ(kTestTimestamp, decoded_frame_.timestamp()); |
| 232 EXPECT_EQ(kTestNtpTimeMs, decoded_frame_.ntp_time_ms()); | 232 EXPECT_EQ(kTestNtpTimeMs, decoded_frame_.ntp_time_ms()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(DecodeWithACompleteKeyFrame)) { | 235 TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(DecodeWithACompleteKeyFrame)) { |
| 236 SetUpEncodeDecode(); | 236 SetUpEncodeDecode(); |
| 237 encoder_->Encode(input_frame_, NULL, NULL); | 237 encoder_->Encode(input_frame_, NULL, NULL); |
| 238 EXPECT_GT(WaitForEncodedFrame(), 0u); | 238 EXPECT_GT(WaitForEncodedFrame(), 0u); |
| 239 // Setting complete to false -> should return an error. | 239 // Setting complete to false -> should return an error. |
| 240 encoded_frame_._completeFrame = false; | 240 encoded_frame_._completeFrame = false; |
| 241 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 241 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 242 decoder_->Decode(encoded_frame_, false, NULL)); | 242 decoder_->Decode(encoded_frame_, false, NULL)); |
| 243 // Setting complete back to true. Forcing a delta frame. | 243 // Setting complete back to true. Forcing a delta frame. |
| 244 encoded_frame_._frameType = kDeltaFrame; | 244 encoded_frame_._frameType = kVideoFrameDelta; |
| 245 encoded_frame_._completeFrame = true; | 245 encoded_frame_._completeFrame = true; |
| 246 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 246 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 247 decoder_->Decode(encoded_frame_, false, NULL)); | 247 decoder_->Decode(encoded_frame_, false, NULL)); |
| 248 // Now setting a key frame. | 248 // Now setting a key frame. |
| 249 encoded_frame_._frameType = kKeyFrame; | 249 encoded_frame_._frameType = kVideoFrameKey; |
| 250 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 250 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 251 decoder_->Decode(encoded_frame_, false, NULL)); | 251 decoder_->Decode(encoded_frame_, false, NULL)); |
| 252 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); | 252 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); |
| 253 } | 253 } |
| 254 | 254 |
| 255 TEST_F(TestVp8Impl, TestReset) { | 255 TEST_F(TestVp8Impl, TestReset) { |
| 256 SetUpEncodeDecode(); | 256 SetUpEncodeDecode(); |
| 257 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 257 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
| 258 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); | 258 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); |
| 259 size_t length = CalcBufferSize(kI420, kWidth, kHeight); | 259 size_t length = CalcBufferSize(kI420, kWidth, kHeight); |
| 260 rtc::scoped_ptr<uint8_t[]> first_frame_buffer(new uint8_t[length]); | 260 rtc::scoped_ptr<uint8_t[]> first_frame_buffer(new uint8_t[length]); |
| 261 ExtractBuffer(decoded_frame_, length, first_frame_buffer.get()); | 261 ExtractBuffer(decoded_frame_, length, first_frame_buffer.get()); |
| 262 | 262 |
| 263 EXPECT_EQ(0, decoder_->Reset()); | 263 EXPECT_EQ(0, decoder_->Reset()); |
| 264 | 264 |
| 265 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); | 265 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); |
| 266 rtc::scoped_ptr<uint8_t[]> second_frame_buffer(new uint8_t[length]); | 266 rtc::scoped_ptr<uint8_t[]> second_frame_buffer(new uint8_t[length]); |
| 267 ExtractBuffer(decoded_frame_, length, second_frame_buffer.get()); | 267 ExtractBuffer(decoded_frame_, length, second_frame_buffer.get()); |
| 268 | 268 |
| 269 EXPECT_EQ( | 269 EXPECT_EQ( |
| 270 0, memcmp(second_frame_buffer.get(), first_frame_buffer.get(), length)); | 270 0, memcmp(second_frame_buffer.get(), first_frame_buffer.get(), length)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace webrtc | 273 } // namespace webrtc |
| OLD | NEW |