| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, | 266 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, |
| 267 RTCVideoDecoder::ID_LAST)); | 267 RTCVideoDecoder::ID_LAST)); |
| 268 EXPECT_TRUE( | 268 EXPECT_TRUE( |
| 269 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); | 269 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); |
| 270 EXPECT_FALSE( | 270 EXPECT_FALSE( |
| 271 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); | 271 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 TEST_P(RTCVideoDecoderTest, DecodeResetsAfterError) { | 275 TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) { |
| 276 const webrtc::VideoCodecType codec_type = GetParam(); | 276 const webrtc::VideoCodecType codec_type = GetParam(); |
| 277 CreateDecoder(codec_type); | 277 CreateDecoder(codec_type); |
| 278 Initialize(); | 278 Initialize(); |
| 279 | 279 |
| 280 webrtc::EncodedImage input_image; | 280 webrtc::EncodedImage input_image; |
| 281 input_image._completeFrame = true; | 281 input_image._completeFrame = true; |
| 282 input_image._encodedWidth = kMinResolutionWidth; | 282 input_image._encodedWidth = kMinResolutionWidth; |
| 283 input_image._encodedHeight = kMaxResolutionHeight; | 283 input_image._encodedHeight = kMaxResolutionHeight; |
| 284 input_image._frameType = webrtc::kVideoFrameDelta; | 284 input_image._frameType = webrtc::kVideoFrameDelta; |
| 285 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 285 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 286 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); | 286 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 287 RunUntilIdle(); | 287 RunUntilIdle(); |
| 288 | 288 |
| 289 // Notify the decoder about a platform error. | 289 // Notify the decoder about a platform error. |
| 290 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 290 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 291 RunUntilIdle(); | 291 RunUntilIdle(); |
| 292 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 292 | 293 |
| 293 // Expect decode call to reset decoder, and set up a new VDA to track it. | 294 // Expect decode call to reset decoder, and set up a new VDA to track it. |
| 294 SetUpResetVDA(); | 295 SetUpResetVDA(); |
| 295 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 296 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 296 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); | 297 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 298 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 299 |
| 300 // Decoder expects a keyframe after reset, so drops any other frames. |
| 301 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 302 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); |
| 303 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 304 |
| 305 // Decoder resets error counter after a successfull decode. |
| 306 input_image._frameType = webrtc::kVideoFrameKey; |
| 307 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 308 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 10)); |
| 309 EXPECT_EQ(0, rtc_decoder_->GetVDAErrorCounterForTesting()); |
| 297 } | 310 } |
| 298 | 311 |
| 299 INSTANTIATE_TEST_CASE_P(CodecProfiles, | 312 INSTANTIATE_TEST_CASE_P(CodecProfiles, |
| 300 RTCVideoDecoderTest, | 313 RTCVideoDecoderTest, |
| 301 Values(webrtc::kVideoCodecVP8, | 314 Values(webrtc::kVideoCodecVP8, |
| 302 webrtc::kVideoCodecH264)); | 315 webrtc::kVideoCodecH264)); |
| 303 | 316 |
| 304 } // content | 317 } // content |
| OLD | NEW |