diff --git a/starboard/android/shared/test_filters.py b/starboard/android/shared/test_filters.py index cb1953f82801..39274720f7a1 100644 --- a/starboard/android/shared/test_filters.py +++ b/starboard/android/shared/test_filters.py @@ -83,15 +83,9 @@ # TODO: Filter this test on a per-device basis. 'SbMediaCanPlayMimeAndKeySystem.MinimumSupport', - # TODO: b/289281412 Make this test work on lab devices consistently. - 'SbPlayerWriteSampleTests/SbPlayerWriteSampleTest.PartialAudio/*', - # TODO: b/292319097 Make this test work on lab devices consistently. 'SbPlayerTest.MaxVideoCapabilities', - # TODO: b/292409536 Make this test fork on lab devices consistently. - 'SbPlayerWriteSampleTests/SbPlayerWriteSampleTest.PartialAudioDiscardAll/*', - # TODO: b/280432564 Make this test work on lab devices consistently. 'SbAudioSinkTest.ContinuousAppend', ], diff --git a/starboard/shared/starboard/player/filter/audio_frame_discarder.cc b/starboard/shared/starboard/player/filter/audio_frame_discarder.cc index 7b8d1922d672..731ec529d90e 100644 --- a/starboard/shared/starboard/player/filter/audio_frame_discarder.cc +++ b/starboard/shared/starboard/player/filter/audio_frame_discarder.cc @@ -49,9 +49,7 @@ void AudioFrameDiscarder::AdjustForDiscardedDurations( scoped_refptr* decoded_audio) { SB_DCHECK(decoded_audio); SB_DCHECK(*decoded_audio); - // TODO: Comment out the SB_DCHECK due to b/274021285. We can re-enable it - // after b/274021285 is resolved. - // SB_DCHECK(!input_buffer_infos_.empty()); + SB_DCHECK(!input_buffer_infos_.empty()); if (input_buffer_infos_.empty()) { SB_LOG(WARNING) << "Inconsistent number of audio decoder outputs. Received " @@ -60,11 +58,16 @@ void AudioFrameDiscarder::AdjustForDiscardedDurations( } auto info = input_buffer_infos_.front(); - SB_LOG_IF(WARNING, info.timestamp != (*decoded_audio)->timestamp()) - << "Inconsistent timestamps between InputBuffer (@" << info.timestamp - << ") and DecodedAudio (@" << (*decoded_audio)->timestamp() << ")."; input_buffer_infos_.pop(); + // The timestamps may have a small offset due to the precision of computation. + if (std::abs(info.timestamp - (*decoded_audio)->timestamp()) > 10) { + SB_LOG(WARNING) << "Inconsistent timestamps between InputBuffer (@" + << info.timestamp << ") and DecodedAudio (@" + << (*decoded_audio)->timestamp() << ")."; + return; + } + (*decoded_audio) ->AdjustForDiscardedDurations(sample_rate, info.discarded_duration_from_front, diff --git a/starboard/shared/starboard/player/filter/audio_frame_discarder.h b/starboard/shared/starboard/player/filter/audio_frame_discarder.h index a1f4f3776eed..d85701446c28 100644 --- a/starboard/shared/starboard/player/filter/audio_frame_discarder.h +++ b/starboard/shared/starboard/player/filter/audio_frame_discarder.h @@ -35,8 +35,6 @@ namespace filter { // corresponding InputBuffer object isn't available at the time. // This class assumes that there is exact one DecodedAudio object produced for // one InputBuffer object, which may not always be the case. -// TODO(b/274021285): Ensure that the class works when there isn't a 1:1 -// relationship between DecodedAudio and InputBuffer. class AudioFrameDiscarder { public: void OnInputBuffers(const InputBuffers& input_buffers);