Skip to content

Commit

Permalink
frameUsec -> frameDurationUsec
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn committed Apr 2, 2024
1 parent a7ae2b7 commit bf14d83
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit.MICROSECONDS
import java.util.concurrent.TimeUnit.MILLISECONDS

class SimpleMp4FrameMuxer(path: String, fps: Float) : SimpleFrameMuxer {
private val frameUsec: Long = (TimeUnit.SECONDS.toMicros(1L) / fps).toLong()
private val frameDurationUsec: Long = (TimeUnit.SECONDS.toMicros(1L) / fps).toLong()

private val muxer: MediaMuxer = MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4)

Expand All @@ -59,7 +59,7 @@ class SimpleMp4FrameMuxer(path: String, fps: Float) : SimpleFrameMuxer {
// This code will break if the encoder supports B frames.
// Ideally we would use set the value in the encoder,
// don't know how to do that without using OpenGL
finalVideoTime = frameUsec * videoFrames++
finalVideoTime = frameDurationUsec * videoFrames++
bufferInfo.presentationTimeUs = finalVideoTime

// encodedData.position(bufferInfo.offset)
Expand All @@ -78,6 +78,6 @@ class SimpleMp4FrameMuxer(path: String, fps: Float) : SimpleFrameMuxer {
return 0
}
// have to add one sec as we calculate it 0-based above
return MILLISECONDS.convert(finalVideoTime + frameUsec, MICROSECONDS)
return MILLISECONDS.convert(finalVideoTime + frameDurationUsec, MICROSECONDS)
}
}

0 comments on commit bf14d83

Please sign in to comment.