Skip to content

Commit

Permalink
Avoid race in MSE_Widevine tests
Browse files Browse the repository at this point in the history
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 <xhwang@chromium.org>
Commit-Queue: Wojciech Dzierżanowski <wdzierzanowski@opera.com>
Cr-Commit-Position: refs/heads/master@{#524663}
  • Loading branch information
wdzierzanowski authored and Commit Bot committed Dec 18, 2017
1 parent f3037b3 commit c42add4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions media/cdm/stub/stub_cdm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */) {
Expand All @@ -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() {
Expand Down

0 comments on commit c42add4

Please sign in to comment.