| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 // Tests/Verifies that |rtc_encoder_| drops incoming frames and its error | 285 // Tests/Verifies that |rtc_encoder_| drops incoming frames and its error |
| 286 // counter is increased when in an error condition. | 286 // counter is increased when in an error condition. |
| 287 TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) { | 287 TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) { |
| 288 const webrtc::VideoCodecType codec_type = GetParam(); | 288 const webrtc::VideoCodecType codec_type = GetParam(); |
| 289 CreateDecoder(codec_type); | 289 CreateDecoder(codec_type); |
| 290 Initialize(); | 290 Initialize(); |
| 291 | 291 |
| 292 webrtc::EncodedImage input_image; | 292 webrtc::EncodedImage input_image; |
| 293 input_image._completeFrame = true; | 293 input_image._completeFrame = true; |
| 294 input_image._encodedWidth = kMinResolutionWidth; | 294 input_image._encodedWidth = 0; |
| 295 input_image._encodedHeight = kMaxResolutionHeight; | 295 input_image._encodedHeight = 0; |
| 296 input_image._frameType = webrtc::kVideoFrameDelta; | 296 input_image._frameType = webrtc::kVideoFrameDelta; |
| 297 input_image._length = kMinResolutionWidth * kMaxResolutionHeight; | 297 input_image._length = kMinResolutionWidth * kMaxResolutionHeight; |
| 298 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 298 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 299 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); | 299 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 300 RunUntilIdle(); | 300 RunUntilIdle(); |
| 301 | 301 |
| 302 // Notify the decoder about a platform error. | 302 // Notify the decoder about a platform error. |
| 303 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 303 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 304 RunUntilIdle(); | 304 RunUntilIdle(); |
| 305 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); | 305 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 306 | 306 |
| 307 // Expect decode call to reset decoder, and set up a new VDA to track it. | 307 // Expect decode call to reset decoder, and set up a new VDA to track it. |
| 308 SetUpResetVDA(); | 308 SetUpResetVDA(); |
| 309 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 309 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 310 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); | 310 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 311 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); | 311 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 312 | 312 |
| 313 // Decoder expects a keyframe after reset, so drops any other frames. However, | 313 // Decoder expects a frame with size after reset, so drops any other frames. |
| 314 // we should still increment the error counter. | 314 // However, we should still increment the error counter. |
| 315 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 315 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 316 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); | 316 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 317 EXPECT_EQ(2, rtc_decoder_->GetVDAErrorCounterForTesting()); | 317 EXPECT_EQ(2, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 INSTANTIATE_TEST_CASE_P(CodecProfiles, | 320 INSTANTIATE_TEST_CASE_P(CodecProfiles, |
| 321 RTCVideoDecoderTest, | 321 RTCVideoDecoderTest, |
| 322 Values(webrtc::kVideoCodecVP8, | 322 Values(webrtc::kVideoCodecVP8, |
| 323 webrtc::kVideoCodecH264)); | 323 webrtc::kVideoCodecH264)); |
| 324 | 324 |
| 325 } // content | 325 } // content |
| OLD | NEW |