Commit 9f486336 by ibaker Committed by Oliver Woodman

Migrate literal usages of 1000 to (new) C.MILLIS_PER_SECOND

This only covers calls to scaleLargeTimestamp()

PiperOrigin-RevId: 261878019
parent 97183ef5
......@@ -964,7 +964,9 @@ public class FragmentedMp4Extractor implements Extractor {
// duration == 0). Other uses of edit lists are uncommon and unsupported.
if (track.editListDurations != null && track.editListDurations.length == 1
&& track.editListDurations[0] == 0) {
edtsOffset = Util.scaleLargeTimestamp(track.editListMediaTimes[0], 1000, track.timescale);
edtsOffset =
Util.scaleLargeTimestamp(
track.editListMediaTimes[0], C.MILLIS_PER_SECOND, track.timescale);
}
int[] sampleSizeTable = fragment.sampleSizeTable;
......@@ -992,12 +994,13 @@ public class FragmentedMp4Extractor implements Extractor {
// here, because unsigned integers will still be parsed correctly (unless their top bit is
// set, which is never true in practice because sample offsets are always small).
int sampleOffset = trun.readInt();
sampleCompositionTimeOffsetTable[i] = (int) ((sampleOffset * 1000L) / timescale);
sampleCompositionTimeOffsetTable[i] =
(int) ((sampleOffset * C.MILLIS_PER_SECOND) / timescale);
} else {
sampleCompositionTimeOffsetTable[i] = 0;
}
sampleDecodingTimeTable[i] =
Util.scaleLargeTimestamp(cumulativeTime, 1000, timescale) - edtsOffset;
Util.scaleLargeTimestamp(cumulativeTime, C.MILLIS_PER_SECOND, timescale) - edtsOffset;
sampleSizeTable[i] = sampleSize;
sampleIsSyncFrameTable[i] = ((sampleFlags >> 16) & 0x1) == 0
&& (!workaroundEveryVideoFrameIsSyncFrame || i == 0);
......
......@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.metadata.emsg;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.MetadataDecoder;
import com.google.android.exoplayer2.metadata.MetadataInputBuffer;
......@@ -46,7 +47,8 @@ public final class EventMessageDecoder implements MetadataDecoder {
// timestamp and zeroing the field in the sample data. Log a warning if the field is non-zero.
Log.w(TAG, "Ignoring non-zero presentation_time_delta: " + presentationTimeDelta);
}
long durationMs = Util.scaleLargeTimestamp(emsgData.readUnsignedInt(), 1000, timescale);
long durationMs =
Util.scaleLargeTimestamp(emsgData.readUnsignedInt(), C.MILLIS_PER_SECOND, timescale);
long id = emsgData.readUnsignedInt();
byte[] messageData = Arrays.copyOfRange(data, emsgData.getPosition(), size);
return new Metadata(new EventMessage(schemeIdUri, value, durationMs, id, messageData));
......
......@@ -906,7 +906,7 @@ public class DashManifestParser extends DefaultHandler
long id = parseLong(xpp, "id", 0);
long duration = parseLong(xpp, "duration", C.TIME_UNSET);
long presentationTime = parseLong(xpp, "presentationTime", 0);
long durationMs = Util.scaleLargeTimestamp(duration, 1000, timescale);
long durationMs = Util.scaleLargeTimestamp(duration, C.MILLIS_PER_SECOND, timescale);
long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
timescale);
String messageData = parseString(xpp, "messageData", null);
......
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