0.95.2: reopen the sound at the same point when the box's audio clock goes wrong (spurious audio timestamps), instead of drifting
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import androidx.media3.exoplayer.audio.DefaultAudioSink
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||
class AudioClockTest {
|
||||
@Test fun anAudioClockFaultIsRecognisedThroughTheErrorChain() {
|
||||
// ExoPlayer makes this one itself; its constructor is private, so the test reaches it the same way.
|
||||
val fault = DefaultAudioSink.InvalidAudioTrackTimestampException::class.java.getDeclaredConstructor(String::class.java)
|
||||
.apply { isAccessible = true }.newInstance("Spurious audio timestamp (frame position mismatch)")
|
||||
// ExoPlayer wraps it in its own playback error; the check walks the chain of causes.
|
||||
assertTrue(isAudioClockFault(RuntimeException("playback error", fault)))
|
||||
assertTrue(isAudioClockFault(fault))
|
||||
}
|
||||
|
||||
@Test fun otherPlaybackErrorsAreNotTreatedAsAudioClockFaults() {
|
||||
assertFalse(isAudioClockFault(RuntimeException("playback error", IllegalStateException("decoder"))))
|
||||
}
|
||||
|
||||
@Test fun watchingCanBeSwitchedOnAndOff() {
|
||||
watchAudioClock(true); assertTrue(DefaultAudioSink.failOnSpuriousAudioTimestamp)
|
||||
watchAudioClock(false); assertFalse(DefaultAudioSink.failOnSpuriousAudioTimestamp)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user