Commit b03278f2 by Oliver Woodman

Don't assume representations are video in first two DashChunkSource constructors.

parent 4d9dd3f6
...@@ -24,6 +24,7 @@ import com.google.android.exoplayer.chunk.ChunkSampleSource; ...@@ -24,6 +24,7 @@ import com.google.android.exoplayer.chunk.ChunkSampleSource;
import com.google.android.exoplayer.chunk.ChunkSource; import com.google.android.exoplayer.chunk.ChunkSource;
import com.google.android.exoplayer.chunk.FormatEvaluator.AdaptiveEvaluator; import com.google.android.exoplayer.chunk.FormatEvaluator.AdaptiveEvaluator;
import com.google.android.exoplayer.dash.DashChunkSource; import com.google.android.exoplayer.dash.DashChunkSource;
import com.google.android.exoplayer.dash.DefaultDashTrackSelector;
import com.google.android.exoplayer.dash.mpd.AdaptationSet; import com.google.android.exoplayer.dash.mpd.AdaptationSet;
import com.google.android.exoplayer.dash.mpd.MediaPresentationDescription; import com.google.android.exoplayer.dash.mpd.MediaPresentationDescription;
import com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser; import com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser;
...@@ -108,7 +109,8 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe ...@@ -108,7 +109,8 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
LibvpxVideoTrackRenderer videoRenderer = null; LibvpxVideoTrackRenderer videoRenderer = null;
if (!videoRepresentationsList.isEmpty()) { if (!videoRepresentationsList.isEmpty()) {
DataSource videoDataSource = new DefaultUriDataSource(player, bandwidthMeter, userAgent); DataSource videoDataSource = new DefaultUriDataSource(player, bandwidthMeter, userAgent);
ChunkSource videoChunkSource = new DashChunkSource(videoDataSource, ChunkSource videoChunkSource = new DashChunkSource(
DefaultDashTrackSelector.newVideoInstance(null, false, false), videoDataSource,
new AdaptiveEvaluator(bandwidthMeter), manifest.getPeriodDuration(0), new AdaptiveEvaluator(bandwidthMeter), manifest.getPeriodDuration(0),
AdaptationSet.TYPE_VIDEO, videoRepresentations); AdaptationSet.TYPE_VIDEO, videoRepresentations);
ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl, ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
...@@ -123,7 +125,8 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe ...@@ -123,7 +125,8 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
audioRenderer = null; audioRenderer = null;
} else { } else {
DataSource audioDataSource = new DefaultUriDataSource(player, bandwidthMeter, userAgent); DataSource audioDataSource = new DefaultUriDataSource(player, bandwidthMeter, userAgent);
DashChunkSource audioChunkSource = new DashChunkSource(audioDataSource, null, DashChunkSource audioChunkSource = new DashChunkSource(
DefaultDashTrackSelector.newAudioInstance(), audioDataSource, null,
manifest.getPeriodDuration(0), AdaptationSet.TYPE_AUDIO, audioRepresentation); manifest.getPeriodDuration(0), AdaptationSet.TYPE_AUDIO, audioRepresentation);
SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl, SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE); AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE);
......
...@@ -133,6 +133,7 @@ public class DashChunkSource implements ChunkSource, Output { ...@@ -133,6 +133,7 @@ public class DashChunkSource implements ChunkSource, Output {
/** /**
* Lightweight constructor to use for fixed duration content. * Lightweight constructor to use for fixed duration content.
* *
* @param trackSelector Selects tracks to be exposed by this source.
* @param dataSource A {@link DataSource} suitable for loading the media data. * @param dataSource A {@link DataSource} suitable for loading the media data.
* @param adaptiveFormatEvaluator For adaptive tracks, selects from the available formats. * @param adaptiveFormatEvaluator For adaptive tracks, selects from the available formats.
* @param durationMs The duration of the content. * @param durationMs The duration of the content.
...@@ -141,15 +142,17 @@ public class DashChunkSource implements ChunkSource, Output { ...@@ -141,15 +142,17 @@ public class DashChunkSource implements ChunkSource, Output {
* {@link AdaptationSet#TYPE_TEXT}. * {@link AdaptationSet#TYPE_TEXT}.
* @param representations The representations to be considered by the source. * @param representations The representations to be considered by the source.
*/ */
public DashChunkSource(DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator, public DashChunkSource(DashTrackSelector trackSelector, DataSource dataSource,
long durationMs, int adaptationSetType, Representation... representations) { FormatEvaluator adaptiveFormatEvaluator, long durationMs, int adaptationSetType,
this(dataSource, adaptiveFormatEvaluator, durationMs, adaptationSetType, Representation... representations) {
this(trackSelector, dataSource, adaptiveFormatEvaluator, durationMs, adaptationSetType,
Arrays.asList(representations)); Arrays.asList(representations));
} }
/** /**
* Lightweight constructor to use for fixed duration content. * Lightweight constructor to use for fixed duration content.
* *
* @param trackSelector Selects tracks to be exposed by this source.
* @param dataSource A {@link DataSource} suitable for loading the media data. * @param dataSource A {@link DataSource} suitable for loading the media data.
* @param adaptiveFormatEvaluator For adaptive tracks, selects from the available formats. * @param adaptiveFormatEvaluator For adaptive tracks, selects from the available formats.
* @param durationMs The duration of the content. * @param durationMs The duration of the content.
...@@ -158,10 +161,10 @@ public class DashChunkSource implements ChunkSource, Output { ...@@ -158,10 +161,10 @@ public class DashChunkSource implements ChunkSource, Output {
* {@link AdaptationSet#TYPE_TEXT}. * {@link AdaptationSet#TYPE_TEXT}.
* @param representations The representations to be considered by the source. * @param representations The representations to be considered by the source.
*/ */
public DashChunkSource(DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator, public DashChunkSource(DashTrackSelector trackSelector, DataSource dataSource,
long durationMs, int adaptationSetType, List<Representation> representations) { FormatEvaluator adaptiveFormatEvaluator, long durationMs, int adaptationSetType,
this(buildManifest(durationMs, adaptationSetType, representations), List<Representation> representations) {
DefaultDashTrackSelector.newVideoInstance(null, false, false), dataSource, this(buildManifest(durationMs, adaptationSetType, representations), trackSelector, dataSource,
adaptiveFormatEvaluator); adaptiveFormatEvaluator);
} }
......
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