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 {
@Nullable String label,
@Nullable String sampleMimeType,
@Nullable String codecs,
@Nullable Metadata metadata,
int bitrate,
int width,
int height,
int channelCount,
@C.SelectionFlags int selectionFlags,
@Nullable String language) {
if (this.metadata != null) {
metadata = this.metadata.copyWithAppendedEntriesFrom(metadata);
}
return new Format(
id,
label,
......@@ -1127,6 +1133,12 @@ public final class Format implements Parcelable {
codecs = codecsOfType;
}
}
Metadata metadata =
this.metadata == null
? manifestFormat.metadata
: this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);
float frameRate = this.frameRate;
if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
frameRate = manifestFormat.frameRate;
......
......@@ -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.
*
* @param entriesToAppend The entries to append.
......
......@@ -1126,6 +1126,7 @@ import java.util.Map;
playlistFormat.label,
mimeType,
codecs,
playlistFormat.metadata,
bitrate,
playlistFormat.width,
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