mirror of
https://github.com/androidx/media.git
synced 2025-05-15 19:49:50 +08:00
Add FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED to HLS preload media chunks
Issue: #5011 PiperOrigin-RevId: 345425048
This commit is contained in:
parent
09509c2390
commit
4907c2153b
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.source.hls;
|
package com.google.android.exoplayer2.source.hls;
|
||||||
|
|
||||||
|
import static com.google.android.exoplayer2.upstream.DataSpec.FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
@ -92,10 +94,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
// Media segment.
|
// Media segment.
|
||||||
HlsMediaPlaylist.SegmentBase mediaSegment = segmentBaseHolder.segmentBase;
|
HlsMediaPlaylist.SegmentBase mediaSegment = segmentBaseHolder.segmentBase;
|
||||||
DataSpec dataSpec =
|
DataSpec dataSpec =
|
||||||
new DataSpec(
|
new DataSpec.Builder()
|
||||||
UriUtil.resolveToUri(mediaPlaylist.baseUri, mediaSegment.url),
|
.setUri(UriUtil.resolveToUri(mediaPlaylist.baseUri, mediaSegment.url))
|
||||||
mediaSegment.byteRangeOffset,
|
.setPosition(mediaSegment.byteRangeOffset)
|
||||||
mediaSegment.byteRangeLength);
|
.setLength(mediaSegment.byteRangeLength)
|
||||||
|
.setFlags(segmentBaseHolder.isPreload ? FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED : 0)
|
||||||
|
.build();
|
||||||
boolean mediaSegmentEncrypted = mediaSegmentKey != null;
|
boolean mediaSegmentEncrypted = mediaSegmentKey != null;
|
||||||
@Nullable
|
@Nullable
|
||||||
byte[] mediaSegmentIv =
|
byte[] mediaSegmentIv =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user