Commit 9ddd39c1 by aquilescanta Committed by AquilesCanta

Add the HlsMetadataEntry from the Master playlist to the Hls tracks

PiperOrigin-RevId: 243624081
parent e9a7d47f
...@@ -1059,12 +1059,18 @@ public final class Format implements Parcelable { ...@@ -1059,12 +1059,18 @@ public final class Format implements Parcelable {
@Nullable String label, @Nullable String label,
@Nullable String sampleMimeType, @Nullable String sampleMimeType,
@Nullable String codecs, @Nullable String codecs,
@Nullable Metadata metadata,
int bitrate, int bitrate,
int width, int width,
int height, int height,
int channelCount, int channelCount,
@C.SelectionFlags int selectionFlags, @C.SelectionFlags int selectionFlags,
@Nullable String language) { @Nullable String language) {
if (this.metadata != null) {
metadata = this.metadata.copyWithAppendedEntriesFrom(metadata);
}
return new Format( return new Format(
id, id,
label, label,
...@@ -1127,6 +1133,12 @@ public final class Format implements Parcelable { ...@@ -1127,6 +1133,12 @@ public final class Format implements Parcelable {
codecs = codecsOfType; codecs = codecsOfType;
} }
} }
Metadata metadata =
this.metadata == null
? manifestFormat.metadata
: this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);
float frameRate = this.frameRate; float frameRate = this.frameRate;
if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) { if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
frameRate = manifestFormat.frameRate; frameRate = manifestFormat.frameRate;
......
...@@ -79,6 +79,21 @@ public final class Metadata implements Parcelable { ...@@ -79,6 +79,21 @@ public final class Metadata implements Parcelable {
} }
/** /**
* Returns a copy of this metadata with the entries of the specified metadata appended. Returns
* this instance if {@code other} is null.
*
* @param other The metadata that holds the entries to append. If null, this methods returns this
* instance.
* @return The metadata instance with the appended entries.
*/
public Metadata copyWithAppendedEntriesFrom(@Nullable Metadata other) {
if (other == null) {
return this;
}
return copyWithAppendedEntries(other.entries);
}
/**
* Returns a copy of this metadata with the specified entries appended. * Returns a copy of this metadata with the specified entries appended.
* *
* @param entriesToAppend The entries to append. * @param entriesToAppend The entries to append.
......
...@@ -1126,6 +1126,7 @@ import java.util.Map; ...@@ -1126,6 +1126,7 @@ import java.util.Map;
playlistFormat.label, playlistFormat.label,
mimeType, mimeType,
codecs, codecs,
playlistFormat.metadata,
bitrate, bitrate,
playlistFormat.width, playlistFormat.width,
playlistFormat.height, playlistFormat.height,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment