Package 

Class MediaEncoderEngine.Controller

    • Method Summary

      Modifier and Type Method Description
      int notifyStarted(@NonNull() MediaFormat format) Request that the muxer should start.
      boolean isStarted() Whether the muxer is started.
      void write(@NonNull() OutputBufferPool pool, @NonNull() OutputBuffer buffer) Writes the given data to the muxer.
      void requestStop(int track) Requests that the engine stops.
      void notifyStopped(int track) Notifies that the encoder was stopped.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • notifyStarted

         int notifyStarted(@NonNull() MediaFormat format)

        Request that the muxer should start. This is not guaranteed to be executed:we wait for all encoders to call this method, and only then, start the muxer.

        Parameters:
        format - the media format
      • isStarted

         boolean isStarted()

        Whether the muxer is started. MediaEncoders are required to avoidcalling write until this method returns true.

      • write

         void write(@NonNull() OutputBufferPool pool, @NonNull() OutputBuffer buffer)

        Writes the given data to the muxer. Should be called after isStarted returns true. Note: this seems to be thread safe, no lock.TODO: Skip first frames from encoder A when encoder B reported a firstTimeMillistime that is significantly later. This can happen even if we wait for both to start,because notifyFirstFrameMillis can be called while themuxer is still closed.The firstFrameMillis still has a value in computing the absolute times, but it is meantto 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 havelarge differences.

        Parameters:
        pool - pool
        buffer - buffer
      • requestStop

         void requestStop(int track)

        Requests that the engine stops. This is not executed until all encoders callthis method, so it is a kind of soft request, just like notifyStarted. To be used when maxLength / maxSize constraintsare reached, for example.When this succeeds, stop is called.

        Parameters:
        track - track
      • notifyStopped

         void notifyStopped(int track)

        Notifies that the encoder was stopped. After this is called by all encoders,we will actually stop the muxer.

        Parameters:
        track - track