From c42add43e4cc9bc096f4e4a1eadc065b27f0b8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dzier=C5=BCanowski?= Date: Mon, 18 Dec 2017 07:56:08 +0000 Subject: [PATCH] Avoid race in MSE_Widevine tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When run with the stub Widevine CDM, these tests suffer from a race between the result of a failed StubCdm::Decrypt() and a failed StubCdm::UpdateSession(). The tests expect the latter, but the former often arrives first. By allowing the stub to InitializeVideoDecoder() successfully and returning cdm::kNoKey upon DecryptAndDecodeFrame() attempt we avoid the DecryptingDemuxerStream errors altogether, so there is no race anymore. Bug: 768745 Test: 'browser_tests --gtest_filter=*MSE_Widevine*' pass when run with the stub Widevine CDM Change-Id: I35a35d006d118f8f7f9a8a64cf9334017644f4ea Reviewed-on: https://chromium-review.googlesource.com/831026 Reviewed-by: Xiaohan Wang Commit-Queue: Wojciech Dzierżanowski Cr-Commit-Position: refs/heads/master@{#524663} --- media/cdm/stub/stub_cdm.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/media/cdm/stub/stub_cdm.cc b/media/cdm/stub/stub_cdm.cc index 9636f5300f6c2d..faf1ab2ad4e5cd 100644 --- a/media/cdm/stub/stub_cdm.cc +++ b/media/cdm/stub/stub_cdm.cc @@ -114,12 +114,12 @@ cdm::Status StubCdm::Decrypt(const cdm::InputBuffer& /* encrypted_buffer */, cdm::Status StubCdm::InitializeAudioDecoder( const cdm::AudioDecoderConfig& /* audio_decoder_config */) { - return cdm::kDecryptError; + return cdm::kSuccess; } cdm::Status StubCdm::InitializeVideoDecoder( const cdm::VideoDecoderConfig& /* video_decoder_config */) { - return cdm::kDecryptError; + return cdm::kSuccess; } void StubCdm::ResetDecoder(cdm::StreamType /* decoder_type */) { @@ -131,13 +131,13 @@ void StubCdm::DeinitializeDecoder(cdm::StreamType /* decoder_type */) { cdm::Status StubCdm::DecryptAndDecodeFrame( const cdm::InputBuffer& /* encrypted_buffer */, cdm::VideoFrame* /* decoded_frame */) { - return cdm::kDecryptError; + return cdm::kNoKey; } cdm::Status StubCdm::DecryptAndDecodeSamples( const cdm::InputBuffer& /* encrypted_buffer */, cdm::AudioFrames* /* audio_frames */) { - return cdm::kDecryptError; + return cdm::kNoKey; } void StubCdm::Destroy() {