From ac620c7f0c271e166ec242da862d6b7ae56d4d95 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Thu, 18 Jul 2019 07:36:02 -0300 Subject: [PATCH] Add MediaEncoderEngine comments --- .../cameraview/video/encoding/MediaEncoderEngine.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/MediaEncoderEngine.java b/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/MediaEncoderEngine.java index 904e668f..6e2725dc 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/MediaEncoderEngine.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/MediaEncoderEngine.java @@ -309,6 +309,17 @@ public class MediaEncoderEngine { /** * Writes the given data to the muxer. Should be called after {@link #isStarted()} * returns true. Note: this seems to be thread safe, no lock. + * + * TODO: Skip first frames from encoder A when encoder B reported a firstTimeMillis + * time that is significantly later. This can happen even if we wait for both to start, + * because {@link MediaEncoder#notifyFirstFrameMillis(long)} can be called while the + * muxer is still closed. + * + * The firstFrameMillis still has a value in computing the absolute times, but it is meant + * to be the time of the first frame read, not necessarily a frame that will be written. + * + * This controller should coordinate between firstFrameMillis and skip frames that have + * large differences. */ public void write(@NonNull OutputBufferPool pool, @NonNull OutputBuffer buffer) { if (!mMediaMuxerStarted) {