SmoothStreaming: Replace variant bitrate/start_time placeholders

Issue: #2447

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147358615
This commit is contained in:
olly 2017-02-13 10:03:50 -08:00 committed by Oliver Woodman
parent 0316ab80df
commit 8cb3b6ed07

View File

@ -128,8 +128,10 @@ public class SsManifest {
*/
public static class StreamElement {
private static final String URL_PLACEHOLDER_START_TIME = "{start time}";
private static final String URL_PLACEHOLDER_BITRATE = "{bitrate}";
private static final String URL_PLACEHOLDER_START_TIME_1 = "{start time}";
private static final String URL_PLACEHOLDER_START_TIME_2 = "{start_time}";
private static final String URL_PLACEHOLDER_BITRATE_1 = "{bitrate}";
private static final String URL_PLACEHOLDER_BITRATE_2 = "{Bitrate}";
public final int type;
public final String subType;
@ -216,9 +218,13 @@ public class SsManifest {
Assertions.checkState(formats != null);
Assertions.checkState(chunkStartTimes != null);
Assertions.checkState(chunkIndex < chunkStartTimes.size());
String bitrateString = Integer.toString(formats[track].bitrate);
String startTimeString = chunkStartTimes.get(chunkIndex).toString();
String chunkUrl = chunkTemplate
.replace(URL_PLACEHOLDER_BITRATE, Integer.toString(formats[track].bitrate))
.replace(URL_PLACEHOLDER_START_TIME, chunkStartTimes.get(chunkIndex).toString());
.replace(URL_PLACEHOLDER_BITRATE_1, bitrateString)
.replace(URL_PLACEHOLDER_BITRATE_2, bitrateString)
.replace(URL_PLACEHOLDER_START_TIME_1, startTimeString)
.replace(URL_PLACEHOLDER_START_TIME_2, startTimeString);
return UriUtil.resolveToUri(baseUri, chunkUrl);
}