mirror of
https://github.com/androidx/media.git
synced 2025-05-08 08:00:49 +08:00
DASHMediaSource: avoid potentially locking twice
It many happen when changing manifest uri because of http 302 and MPD.Location present.
This commit is contained in:
parent
ca70b10c03
commit
8908cc85ed
@ -792,25 +792,20 @@ public final class DashMediaSource extends BaseMediaSource {
|
|||||||
manifestLoadStartTimestampMs = elapsedRealtimeMs - loadDurationMs;
|
manifestLoadStartTimestampMs = elapsedRealtimeMs - loadDurationMs;
|
||||||
manifestLoadEndTimestampMs = elapsedRealtimeMs;
|
manifestLoadEndTimestampMs = elapsedRealtimeMs;
|
||||||
boolean isRedirect = !loadable.getUri().equals(this.manifestUri);
|
boolean isRedirect = !loadable.getUri().equals(this.manifestUri);
|
||||||
if (isRedirect) {
|
boolean hasLocation = manifest.location != null;
|
||||||
|
|
||||||
|
if (isRedirect || hasLocation) {
|
||||||
synchronized (manifestUriLock) {
|
synchronized (manifestUriLock) {
|
||||||
// This condition checks that replaceManifestUri wasn't called between the start and end of
|
// This condition checks that replaceManifestUri wasn't called between the start and end of
|
||||||
// this load. If it was, we ignore the manifest location and prefer the manual replacement.
|
// this load. If it was, we ignore the manifest location and prefer the manual replacement.
|
||||||
@SuppressWarnings("ReferenceEquality")
|
@SuppressWarnings("ReferenceEquality")
|
||||||
boolean isSameUriInstance = loadable.dataSpec.uri == manifestUri;
|
boolean isSameUriInstance = loadable.dataSpec.uri == manifestUri;
|
||||||
if (isSameUriInstance) {
|
if (isSameUriInstance) {
|
||||||
manifestUri = loadable.getUri();
|
if (hasLocation) {
|
||||||
}
|
manifestUri = manifest.location;
|
||||||
}
|
} else {
|
||||||
}
|
manifestUri = loadable.getUri();
|
||||||
if (manifest.location != null) {
|
}
|
||||||
synchronized (manifestUriLock) {
|
|
||||||
// This condition checks that replaceManifestUri wasn't called between the start and end of
|
|
||||||
// this load. If it was, we ignore the manifest location and prefer the manual replacement.
|
|
||||||
@SuppressWarnings("ReferenceEquality")
|
|
||||||
boolean isSameUriInstance = loadable.dataSpec.uri == manifestUri;
|
|
||||||
if (isSameUriInstance || isRedirect) {
|
|
||||||
manifestUri = manifest.location;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user