mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Use C constants + minor cleanup.
This commit is contained in:
parent
511dd9435a
commit
3d775c1641
5 changed files with 13 additions and 13 deletions
|
|
@ -50,9 +50,7 @@ public class DemoUtil {
|
|||
public static final int TYPE_DASH = 0;
|
||||
public static final int TYPE_SS = 1;
|
||||
public static final int TYPE_OTHER = 2;
|
||||
public static final int TYPE_DASH_LIVE = 3;
|
||||
public static final int TYPE_DASH_LIVE_DVR = 4;
|
||||
public static final int TYPE_HLS = 5;
|
||||
public static final int TYPE_HLS = 3;
|
||||
|
||||
public static final boolean EXPOSE_EXPERIMENTAL_FEATURES = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer.hls;
|
|||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.TrackRenderer;
|
||||
import com.google.android.exoplayer.hls.TsExtractor.SamplePool;
|
||||
import com.google.android.exoplayer.upstream.Aes128DataSource;
|
||||
import com.google.android.exoplayer.upstream.BandwidthMeter;
|
||||
|
|
@ -193,7 +192,7 @@ public class HlsChunkSource {
|
|||
}
|
||||
|
||||
public long getDurationUs() {
|
||||
return live ? TrackRenderer.UNKNOWN_TIME_US : durationUs;
|
||||
return live ? C.UNKNOWN_TIME_US : durationUs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -313,7 +312,7 @@ public class HlsChunkSource {
|
|||
} else /* Not live */ {
|
||||
startTimeUs = segment.startTimeUs;
|
||||
}
|
||||
long endTimeUs = startTimeUs + (long) (segment.durationSecs * 1000000);
|
||||
long endTimeUs = startTimeUs + (long) (segment.durationSecs * C.MICROS_PER_SECOND);
|
||||
boolean isLastChunk = !mediaPlaylist.live && chunkIndex == mediaPlaylist.segments.size() - 1;
|
||||
|
||||
// Configure the extractor that will read the chunk.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package com.google.android.exoplayer.hls;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -77,11 +79,11 @@ public final class HlsMediaPlaylist extends HlsPlaylist {
|
|||
this.live = live;
|
||||
this.segments = segments;
|
||||
|
||||
if (this.segments.size() > 0) {
|
||||
Segment lastSegment = segments.get(this.segments.size() - 1);
|
||||
this.durationUs = lastSegment.startTimeUs + (long) (lastSegment.durationSecs * 1000000);
|
||||
if (!segments.isEmpty()) {
|
||||
Segment last = segments.get(segments.size() - 1);
|
||||
durationUs = last.startTimeUs + (long) (last.durationSecs * C.MICROS_PER_SECOND);
|
||||
} else {
|
||||
this.durationUs = 0;
|
||||
durationUs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public final class HlsPlaylistParser implements ManifestParser<HlsPlaylist> {
|
|||
segments.add(new Segment(line, segmentDurationSecs, segmentDiscontinuity,
|
||||
segmentStartTimeUs, segmentEncryptionMethod, segmentEncryptionKeyUri,
|
||||
segmentEncryptionIV, segmentByterangeOffset, segmentByterangeLength));
|
||||
segmentStartTimeUs += (long) (segmentDurationSecs * 1000000);
|
||||
segmentStartTimeUs += (long) (segmentDurationSecs * C.MICROS_PER_SECOND);
|
||||
segmentDiscontinuity = false;
|
||||
segmentDurationSecs = 0.0;
|
||||
if (segmentByterangeLength != C.LENGTH_UNBOUNDED) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.google.android.exoplayer.hls;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.SampleHolder;
|
||||
import com.google.android.exoplayer.metadata.Eia608Parser;
|
||||
|
|
@ -480,7 +481,7 @@ public final class TsExtractor {
|
|||
pesBuffer.skipBits(1);
|
||||
pts |= pesBuffer.readBitsLong(15);
|
||||
pesBuffer.skipBits(1);
|
||||
timeUs = pts * 1000000 / 90000;
|
||||
timeUs = (pts * C.MICROS_PER_SECOND) / 90000;
|
||||
// Skip the rest of the header.
|
||||
pesBuffer.skipBytes(headerDataLength - 5);
|
||||
} else {
|
||||
|
|
@ -1035,7 +1036,7 @@ public final class TsExtractor {
|
|||
MediaFormat mediaFormat = MediaFormat.createAudioFormat(MimeTypes.AUDIO_AAC,
|
||||
MediaFormat.NO_VALUE, audioParams.second, audioParams.first,
|
||||
Collections.singletonList(audioSpecificConfig));
|
||||
frameDurationUs = (1000000 * 1024L) / mediaFormat.sampleRate;
|
||||
frameDurationUs = (C.MICROS_PER_SECOND * 1024L) / mediaFormat.sampleRate;
|
||||
setMediaFormat(mediaFormat);
|
||||
} else {
|
||||
adtsBuffer.skipBits(10);
|
||||
|
|
|
|||
Loading…
Reference in a new issue