From e0c9c1cbb67fc906e825e2ebec7b611335ea6864 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 1 Dec 2022 21:23:57 +0000 Subject: [PATCH] audio VTS: Clarify numbers used by CompressedOffloadOutputStreamTest Make more clear the origin of numbers used by the test CompressedOffloadOutputStreamTest#Mp3FormatGaplessOffload. No change in the test behavior. Bug: 260676244 Test: m VtsHalAudioV7_1TargetTest Change-Id: I48211ad4510dec7fe90dc6f755485283376eaa23 --- .../vts/functional/7.0/AudioPrimaryHidlHalTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index 505c54c1df..55d4e1d8a6 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -957,10 +957,16 @@ TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { ASSERT_NO_FATAL_FAILURE(createPatchIfNeeded()); const int presentationeEndPrecisionMs = 1000; const int sampleRate = 44100; + // The duration of sine882hz3s.mp3 is: 3 seconds + (576 + 756) samples. + // This is a mono file, thus 1 frame = 1 sample for it. + const int fullTrackDurationMs = 3000 + (576 + 756) * 1000 / sampleRate; const int significantSampleNumber = (presentationeEndPrecisionMs * sampleRate) / 1000; + // 'delay' is the amount of frames ignored at the beginning, 'padding' is the amount of frames + // ignored at the end of the track. Extra 1000 samples are requested for trimming to reduce the + // test running time. const int delay = 576 + 1000; const int padding = 756 + 1000; - const int durationMs = 3000 - 44; + const int durationMs = fullTrackDurationMs - (delay + padding) * 1000 / sampleRate; auto start = std::chrono::steady_clock::now(); auto callbacks = sp::make(); std::mutex presentationEndLock;