Skip to content

Commit

Permalink
Add support for Live DVR
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Michael Reilly committed Sep 23, 2015
1 parent 867c834 commit 54fed33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

version=1.4.2-INTERNAL
group=com.google.exoplayer
version=1.4.2.2
group=com.google.exoplayer
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public interface EventListener extends BaseChunkSampleSourceEventListener {}
private byte[] scratchSpace;
private boolean live;
private long durationUs;

private int targetDurationSecs;
private Uri encryptionKeyUri;
private byte[] encryptionKey;
private String encryptionIvString;
Expand Down Expand Up @@ -192,6 +192,8 @@ public HlsChunkSource(DataSource dataSource, String playlistUrl, HlsPlaylist pla
variantLastPlaylistLoadTimesMs = new long[1];
variantBlacklistTimes = new long[1];
setMediaPlaylist(0, (HlsMediaPlaylist) playlist);
targetDurationSecs = ((HlsMediaPlaylist) playlist).targetDurationSecs;

// We won't be adapting between different variants.
maxWidth = -1;
maxHeight = -1;
Expand Down Expand Up @@ -232,6 +234,14 @@ public long getDurationUs() {
return durationUs;
}

public boolean isLive() {
return live;
}

public int getTargetDurationSecs() {
return targetDurationSecs;
}

/**
* Adaptive implementations must set the maximum video dimensions on the supplied
* {@link MediaFormat}. Other implementations do nothing.
Expand Down Expand Up @@ -281,6 +291,7 @@ public Chunk getChunkOperation(TsChunk previousTsChunk, long seekPositionUs,
int chunkMediaSequence = 0;
boolean liveDiscontinuity = false;
if (live) {
targetDurationSecs = mediaPlaylist.targetDurationSecs;
if (previousTsChunk == null) {
chunkMediaSequence = Util.binarySearchFloor(mediaPlaylist.segments, seekPositionUs, true, true) + mediaPlaylist.mediaSequence;
int liveStartMediaSequence = getLiveStartChunkMediaSequence(selectedVariantIndex);
Expand Down

0 comments on commit 54fed33

Please sign in to comment.