Skip to content

Commit

Permalink
Use current time as initial timestamp on error
Browse files Browse the repository at this point in the history
If the initial timestamp could not be retrieved, use the current time as
returned by System.nanoTime(). In practice, it is the same time base as
AudioRecord timestamps.

Fixes #4536 <#4536>
  • Loading branch information
rom1v committed Dec 16, 2023
1 parent dfd363e commit b10402b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public int read(ByteBuffer directBuffer, MediaCodec.BufferInfo outBufferInfo) {
previousRecorderTimestamp = timestamp.nanoTime;
} else {
if (nextPts == 0) {
Ln.w("Could not get any audio timestamp");
Ln.w("Could not get initial audio timestamp");
nextPts = System.nanoTime() / 1000;
}
// compute from previous timestamp and packet size
pts = nextPts;
Expand Down

0 comments on commit b10402b

Please sign in to comment.