Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 476e38fd authored by Kevin Rocard's avatar Kevin Rocard
Browse files

Audio HAL VTS: GetPresentationPosition may return 0 on stop stream



GetPresentationPosition returns the last time a sample was written to
the hardware.
Calling it on a stop stream should return 0 sample written, but the
timestamps of that measure is of little importance.
Thus allow this timestamp to be 0 indicating that the measure was never
actually made.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3c33b60f98e8cbea269a7739cc1889af932dcff5
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent 8f8730c7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1297,6 +1297,13 @@ TEST_P(OutputStreamTest, GetPresentationPositionStop) {
    }
    ASSERT_EQ(0U, frames);

    if (mesureTS.tvNSec == 0 && mesureTS.tvSec == 0) {
        // As the stream has never written a frame yet,
        // the timestamp does not really have a meaning, allow to return 0
        return;
    }

    // Make sure the return measure is not more than 1s old.
    struct timespec currentTS;
    ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &currentTS)) << errno;