mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Treat -1000 duration as unknown duration for live streams in Cast
Issue: #7983 #minor-release PiperOrigin-RevId: 339016928
This commit is contained in:
parent
1fcfef5cde
commit
270e274ef3
@ -27,6 +27,10 @@ import com.google.android.gms.cast.MediaTrack;
|
|||||||
*/
|
*/
|
||||||
/* package */ final class CastUtils {
|
/* package */ final class CastUtils {
|
||||||
|
|
||||||
|
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */
|
||||||
|
// TODO: Remove once [Internal ref: b/171657375] is fixed.
|
||||||
|
private static final long LIVE_STREAM_DURATION = -1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the duration in microseconds advertised by a media info, or {@link C#TIME_UNSET} if
|
* Returns the duration in microseconds advertised by a media info, or {@link C#TIME_UNSET} if
|
||||||
* unknown or not applicable.
|
* unknown or not applicable.
|
||||||
@ -39,7 +43,9 @@ import com.google.android.gms.cast.MediaTrack;
|
|||||||
return C.TIME_UNSET;
|
return C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
long durationMs = mediaInfo.getStreamDuration();
|
long durationMs = mediaInfo.getStreamDuration();
|
||||||
return durationMs != MediaInfo.UNKNOWN_DURATION ? C.msToUs(durationMs) : C.TIME_UNSET;
|
return durationMs != MediaInfo.UNKNOWN_DURATION && durationMs != LIVE_STREAM_DURATION
|
||||||
|
? C.msToUs(durationMs)
|
||||||
|
: C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user