Use consistent identifiers for extractor periods.

Also, fix clearing the timeline for source info changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130292700
This commit is contained in:
andrewlewis 2016-08-15 10:07:22 -07:00 committed by Oliver Woodman
parent 80227840f6
commit 63ab601d75
2 changed files with 5 additions and 1 deletions

View File

@ -821,6 +821,8 @@ import java.io.IOException;
// Release all loaded periods and seek to the new playing period index.
releasePeriodsFrom(playingPeriod);
playingPeriod = null;
readingPeriod = null;
loadingPeriod = null;
MediaSource.Position defaultStartPosition =
mediaSource.getDefaultStartPosition(newPlayingPeriodIndex);
@ -851,6 +853,8 @@ import java.io.IOException;
index = playingPeriod.index;
releasePeriodsFrom(playingPeriod);
playingPeriod = null;
readingPeriod = null;
loadingPeriod = null;
seekToPeriodPosition(index, 0);
return;
}

View File

@ -135,7 +135,7 @@ public final class ExtractorMediaSource implements MediaSource, MediaSource.List
@Override
public void prepareSource(MediaSource.Listener listener) {
sourceListener = listener;
timeline = new SinglePeriodTimeline(this, C.UNSET_TIME_US, false);
timeline = new SinglePeriodTimeline(0, C.UNSET_TIME_US, false);
listener.onSourceInfoRefreshed(timeline, null);
}