mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
fix: prevent infinite loop causing stream freeze in DASH multi-period streams
- Added a condition to ensure `requiredIntervalUs > 0` in `DashMediaSource`. - Resolves an issue where negative `requiredIntervalUs` triggered an infinite loop in `onPlaylistUpdateRequested()`, leading to application/stream freezes. This fix restores smooth playback for multi-period DASH streams.
This commit is contained in:
parent
59789b7209
commit
5da67a0033
@ -1151,8 +1151,9 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
+ index.getNextSegmentAvailableTimeUs(periodDurationUs, nowUnixTimeUs);
|
||||
long requiredIntervalUs = nextSegmentShiftUnixTimeUs - nowUnixTimeUs;
|
||||
// Avoid multiple refreshes within a very small amount of time.
|
||||
if (requiredIntervalUs < intervalUs - 100_000
|
||||
|| (requiredIntervalUs > intervalUs && requiredIntervalUs < intervalUs + 100_000)) {
|
||||
if ((requiredIntervalUs < intervalUs - 100_000
|
||||
|| (requiredIntervalUs > intervalUs && requiredIntervalUs < intervalUs + 100_000) )
|
||||
&& requiredIntervalUs >0) {
|
||||
intervalUs = requiredIntervalUs;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user