mirror of
https://github.com/samsonjs/media.git
synced 2026-03-28 09:55:48 +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.FormatEvaluator.AdaptiveEvaluator;
|
||||
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.MediaPresentationDescription;
|
||||
import com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser;
|
||||
|
|
@ -108,7 +109,8 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
|
|||
LibvpxVideoTrackRenderer videoRenderer = null;
|
||||
if (!videoRepresentationsList.isEmpty()) {
|
||||
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),
|
||||
AdaptationSet.TYPE_VIDEO, videoRepresentations);
|
||||
ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
|
||||
|
|
@ -123,8 +125,9 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
|
|||
audioRenderer = null;
|
||||
} else {
|
||||
DataSource audioDataSource = new DefaultUriDataSource(player, bandwidthMeter, userAgent);
|
||||
DashChunkSource audioChunkSource = new DashChunkSource(audioDataSource, null,
|
||||
manifest.getPeriodDuration(0), AdaptationSet.TYPE_AUDIO, audioRepresentation);
|
||||
DashChunkSource audioChunkSource = new DashChunkSource(
|
||||
DefaultDashTrackSelector.newAudioInstance(), audioDataSource, null,
|
||||
manifest.getPeriodDuration(0), AdaptationSet.TYPE_AUDIO, audioRepresentation);
|
||||
SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
|
||||
AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE);
|
||||
if (audioRepresentationIsOpus) {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public class DashChunkSource implements ChunkSource, Output {
|
|||
/**
|
||||
* 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 adaptiveFormatEvaluator For adaptive tracks, selects from the available formats.
|
||||
* @param durationMs The duration of the content.
|
||||
|
|
@ -141,15 +142,17 @@ public class DashChunkSource implements ChunkSource, Output {
|
|||
* {@link AdaptationSet#TYPE_TEXT}.
|
||||
* @param representations The representations to be considered by the source.
|
||||
*/
|
||||
public DashChunkSource(DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator,
|
||||
long durationMs, int adaptationSetType, Representation... representations) {
|
||||
this(dataSource, adaptiveFormatEvaluator, durationMs, adaptationSetType,
|
||||
public DashChunkSource(DashTrackSelector trackSelector, DataSource dataSource,
|
||||
FormatEvaluator adaptiveFormatEvaluator, long durationMs, int adaptationSetType,
|
||||
Representation... representations) {
|
||||
this(trackSelector, dataSource, adaptiveFormatEvaluator, durationMs, adaptationSetType,
|
||||
Arrays.asList(representations));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 adaptiveFormatEvaluator For adaptive tracks, selects from the available formats.
|
||||
* @param durationMs The duration of the content.
|
||||
|
|
@ -158,10 +161,10 @@ public class DashChunkSource implements ChunkSource, Output {
|
|||
* {@link AdaptationSet#TYPE_TEXT}.
|
||||
* @param representations The representations to be considered by the source.
|
||||
*/
|
||||
public DashChunkSource(DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator,
|
||||
long durationMs, int adaptationSetType, List<Representation> representations) {
|
||||
this(buildManifest(durationMs, adaptationSetType, representations),
|
||||
DefaultDashTrackSelector.newVideoInstance(null, false, false), dataSource,
|
||||
public DashChunkSource(DashTrackSelector trackSelector, DataSource dataSource,
|
||||
FormatEvaluator adaptiveFormatEvaluator, long durationMs, int adaptationSetType,
|
||||
List<Representation> representations) {
|
||||
this(buildManifest(durationMs, adaptationSetType, representations), trackSelector, dataSource,
|
||||
adaptiveFormatEvaluator);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue