mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't assume representations are video in first two DashChunkSource constructors.
This commit is contained in:
parent
4d9dd3f6e6
commit
b03278f2bf
2 changed files with 16 additions and 10 deletions
|
|
@ -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
|
||||||
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,8 +125,9 @@ 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(
|
||||||
manifest.getPeriodDuration(0), AdaptationSet.TYPE_AUDIO, audioRepresentation);
|
DefaultDashTrackSelector.newAudioInstance(), audioDataSource, null,
|
||||||
|
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);
|
||||||
if (audioRepresentationIsOpus) {
|
if (audioRepresentationIsOpus) {
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
* {@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 {
|
||||||
* {@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue