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

Side by Side Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 2093823002: Consider non-keyframes for RTCVideoEncoder error counter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 // 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 RTCVideoDecoder::ID_HALF + 2, RTCVideoDecoder::ID_HALF)); 275 RTCVideoDecoder::ID_HALF + 2, RTCVideoDecoder::ID_HALF));
276 276
277 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, 277 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST,
278 RTCVideoDecoder::ID_LAST)); 278 RTCVideoDecoder::ID_LAST));
279 EXPECT_TRUE( 279 EXPECT_TRUE(
280 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); 280 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST));
281 EXPECT_FALSE( 281 EXPECT_FALSE(
282 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); 282 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST));
283 } 283 }
284 284
285 285
mcasas 2016/06/30 18:07:25 Remove empty line. Better off: write a test descri
286 TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) { 286 TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) {
287 const webrtc::VideoCodecType codec_type = GetParam(); 287 const webrtc::VideoCodecType codec_type = GetParam();
288 CreateDecoder(codec_type); 288 CreateDecoder(codec_type);
289 Initialize(); 289 Initialize();
290 290
291 webrtc::EncodedImage input_image; 291 webrtc::EncodedImage input_image;
292 input_image._completeFrame = true; 292 input_image._completeFrame = true;
293 input_image._encodedWidth = kMinResolutionWidth; 293 input_image._encodedWidth = kMinResolutionWidth;
294 input_image._encodedHeight = kMaxResolutionHeight; 294 input_image._encodedHeight = kMaxResolutionHeight;
295 input_image._frameType = webrtc::kVideoFrameDelta; 295 input_image._frameType = webrtc::kVideoFrameDelta;
296 input_image._length = kMinResolutionWidth * kMaxResolutionHeight;
296 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, 297 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
297 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); 298 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0));
298 RunUntilIdle(); 299 RunUntilIdle();
299 300
300 // Notify the decoder about a platform error. 301 // Notify the decoder about a platform error.
301 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 302 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
302 RunUntilIdle(); 303 RunUntilIdle();
303 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); 304 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting());
304 305
305 // Expect decode call to reset decoder, and set up a new VDA to track it. 306 // Expect decode call to reset decoder, and set up a new VDA to track it.
306 SetUpResetVDA(); 307 SetUpResetVDA();
307 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, 308 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
308 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); 309 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0));
309 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); 310 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting());
310 311
311 // Decoder expects a keyframe after reset, so drops any other frames. 312 // Decoder expects a keyframe after reset, so drops any other frames. However,
313 // we should still increment the error counter.
312 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, 314 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
313 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0)); 315 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0));
314 EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting()); 316 EXPECT_EQ(2, rtc_decoder_->GetVDAErrorCounterForTesting());
315
316 // Decoder resets error counter after a successfull decode.
317 input_image._frameType = webrtc::kVideoFrameKey;
318 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
319 rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 10));
320 EXPECT_EQ(0, rtc_decoder_->GetVDAErrorCounterForTesting());
321 } 317 }
322 318
323 INSTANTIATE_TEST_CASE_P(CodecProfiles, 319 INSTANTIATE_TEST_CASE_P(CodecProfiles,
324 RTCVideoDecoderTest, 320 RTCVideoDecoderTest,
325 Values(webrtc::kVideoCodecVP8, 321 Values(webrtc::kVideoCodecVP8,
326 webrtc::kVideoCodecH264)); 322 webrtc::kVideoCodecH264));
327 323
328 } // content 324 } // content
OLDNEW
« content/renderer/media/rtc_video_decoder.cc ('K') | « content/renderer/media/rtc_video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698