Skip to content

Commit

Permalink
[android] Ensure MinRequiredFramesTester can start
Browse files Browse the repository at this point in the history
Start MinRequiredFramesTester with no less frames than the return value
from AudioTrack.getMinBufferSize(). Otherwise, AudioTrack may not be
able to start playing.

b/390500247
  • Loading branch information
jasonzhangxx committed Jan 22, 2025
1 parent 41f30d8 commit 0dd7c92
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions starboard/android/shared/audio_track_audio_sink_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,16 @@ void AudioTrackAudioSinkType::TestMinRequiredFrames() {
sample_type = kSbMediaAudioSampleTypeInt16Deprecated;
SB_DCHECK(SbAudioSinkIsAudioSampleTypeSupported(sample_type));
}
min_required_frames_tester_.AddTest(2, sample_type, kSampleFrequency48000,
onMinRequiredFramesForWebAudioReceived,
8 * 1024);
min_required_frames_tester_.AddTest(2, sample_type, kSampleFrequency22050,
onMinRequiredFramesForWebAudioReceived,
4 * 1024);
min_required_frames_tester_.AddTest(
2, sample_type, kSampleFrequency48000,
onMinRequiredFramesForWebAudioReceived,
std::max(8 * 1024, AudioTrackBridge::GetMinBufferSizeInFrames(
sample_type, 2, kSampleFrequency48000)));
min_required_frames_tester_.AddTest(
2, sample_type, kSampleFrequency22050,
onMinRequiredFramesForWebAudioReceived,
std::max(4 * 1024, AudioTrackBridge::GetMinBufferSizeInFrames(
sample_type, 2, kSampleFrequency22050)));
min_required_frames_tester_.Start();
}

Expand Down

0 comments on commit 0dd7c92

Please sign in to comment.