Skip to content

Commit

Permalink
SmoothStreaming: Replace variant bitrate/start_time placeholders
Browse files Browse the repository at this point in the history
Issue: #2447

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147358615
  • Loading branch information
ojw28 committed Feb 15, 2017
1 parent 0316ab8 commit 8cb3b6e
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ public ProtectionElement(UUID uuid, byte[] data) {
*/
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;
Expand Down Expand Up @@ -216,9 +218,13 @@ public Uri buildRequestUri(int track, int chunkIndex) {
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);
}

Expand Down

0 comments on commit 8cb3b6e

Please sign in to comment.