2022-06-10 21:38:30 +09:00

400 lines
7.7 KiB
Smali

.class public final Lcom/google/android/exoplayer2/util/TimestampAdjuster;
.super Ljava/lang/Object;
.source "TimestampAdjuster.java"
# static fields
.field public static final DO_NOT_OFFSET:J = 0x7fffffffffffffffL
.field private static final MAX_PTS_PLUS_ONE:J = 0x200000000L
# instance fields
.field private firstSampleTimestampUs:J
.field private volatile lastSampleTimestamp:J
.field private timestampOffsetUs:J
# direct methods
.method public constructor <init>(J)V
.locals 2
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-wide v0, -0x7fffffffffffffffL # -4.9E-324
.line 2
iput-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
.line 3
invoke-virtual {p0, p1, p2}, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->setFirstSampleTimestampUs(J)V
return-void
.end method
.method public static ptsToUs(J)J
.locals 2
const-wide/32 v0, 0xf4240
mul-long/2addr p0, v0
const-wide/32 v0, 0x15f90
.line 1
div-long/2addr p0, v0
return-wide p0
.end method
.method public static usToPts(J)J
.locals 2
const-wide/32 v0, 0x15f90
mul-long/2addr p0, v0
const-wide/32 v0, 0xf4240
.line 1
div-long/2addr p0, v0
return-wide p0
.end method
# virtual methods
.method public adjustSampleTimestamp(J)J
.locals 4
const-wide v0, -0x7fffffffffffffffL # -4.9E-324
cmp-long v2, p1, v0
if-nez v2, :cond_0
return-wide v0
.line 1
:cond_0
iget-wide v2, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
cmp-long v0, v2, v0
if-eqz v0, :cond_1
.line 2
iput-wide p1, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
goto :goto_0
.line 3
:cond_1
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->firstSampleTimestampUs:J
const-wide v2, 0x7fffffffffffffffL
cmp-long v2, v0, v2
if-eqz v2, :cond_2
sub-long/2addr v0, p1
.line 4
iput-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->timestampOffsetUs:J
.line 5
:cond_2
monitor-enter p0
.line 6
:try_start_0
iput-wide p1, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
.line 7
invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
.line 8
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 9
:goto_0
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->timestampOffsetUs:J
add-long/2addr p1, v0
return-wide p1
:catchall_0
move-exception p1
.line 10
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method
.method public adjustTsTimestamp(J)J
.locals 8
const-wide v0, -0x7fffffffffffffffL # -4.9E-324
cmp-long v2, p1, v0
if-nez v2, :cond_0
return-wide v0
.line 1
:cond_0
iget-wide v2, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
cmp-long v0, v2, v0
if-eqz v0, :cond_2
.line 2
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
invoke-static {v0, v1}, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->usToPts(J)J
move-result-wide v0
const-wide v2, 0x100000000L
add-long/2addr v2, v0
const-wide v4, 0x200000000L
.line 3
div-long/2addr v2, v4
const-wide/16 v6, 0x1
sub-long v6, v2, v6
mul-long/2addr v6, v4
add-long/2addr v6, p1
mul-long/2addr v2, v4
add-long/2addr v2, p1
sub-long p1, v6, v0
.line 4
invoke-static {p1, p2}, Ljava/lang/Math;->abs(J)J
move-result-wide p1
sub-long v0, v2, v0
invoke-static {v0, v1}, Ljava/lang/Math;->abs(J)J
move-result-wide v0
cmp-long p1, p1, v0
if-gez p1, :cond_1
move-wide p1, v6
goto :goto_0
:cond_1
move-wide p1, v2
.line 5
:cond_2
:goto_0
invoke-static {p1, p2}, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->ptsToUs(J)J
move-result-wide p1
invoke-virtual {p0, p1, p2}, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->adjustSampleTimestamp(J)J
move-result-wide p1
return-wide p1
.end method
.method public getFirstSampleTimestampUs()J
.locals 2
.line 1
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->firstSampleTimestampUs:J
return-wide v0
.end method
.method public getLastAdjustedTimestampUs()J
.locals 6
.line 1
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
const-wide v2, -0x7fffffffffffffffL # -4.9E-324
cmp-long v0, v0, v2
if-eqz v0, :cond_0
iget-wide v2, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
goto :goto_0
:cond_0
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->firstSampleTimestampUs:J
const-wide v4, 0x7fffffffffffffffL
cmp-long v4, v0, v4
if-eqz v4, :cond_1
move-wide v2, v0
:cond_1
:goto_0
return-wide v2
.end method
.method public getTimestampOffsetUs()J
.locals 5
.line 1
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->firstSampleTimestampUs:J
const-wide v2, 0x7fffffffffffffffL
cmp-long v0, v0, v2
const-wide v1, -0x7fffffffffffffffL # -4.9E-324
if-nez v0, :cond_0
const-wide/16 v1, 0x0
goto :goto_0
:cond_0
iget-wide v3, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
cmp-long v0, v3, v1
if-nez v0, :cond_1
goto :goto_0
:cond_1
iget-wide v1, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->timestampOffsetUs:J
:goto_0
return-wide v1
.end method
.method public reset()V
.locals 2
const-wide v0, -0x7fffffffffffffffL # -4.9E-324
.line 1
iput-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
return-void
.end method
.method public declared-synchronized setFirstSampleTimestampUs(J)V
.locals 4
monitor-enter p0
.line 1
:try_start_0
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
const-wide v2, -0x7fffffffffffffffL # -4.9E-324
cmp-long v0, v0, v2
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
invoke-static {v0}, Lcom/google/android/exoplayer2/util/Assertions;->checkState(Z)V
.line 2
iput-wide p1, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->firstSampleTimestampUs:J
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 3
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized waitUntilInitialized()V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;
}
.end annotation
monitor-enter p0
.line 1
:goto_0
:try_start_0
iget-wide v0, p0, Lcom/google/android/exoplayer2/util/TimestampAdjuster;->lastSampleTimestamp:J
const-wide v2, -0x7fffffffffffffffL # -4.9E-324
cmp-long v0, v0, v2
if-nez v0, :cond_0
.line 2
invoke-virtual {p0}, Ljava/lang/Object;->wait()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
.line 3
:cond_0
monitor-exit p0
return-void
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method