-
public class MediaEncoderEngine.ControllerA handle for MediaEncoders to pass information to this engine.All methods here can be called for multiple threads.
-
-
Method Summary
Modifier and Type Method Description intnotifyStarted(@NonNull() MediaFormat format)Request that the muxer should start. booleanisStarted()Whether the muxer is started. voidwrite(@NonNull() OutputBufferPool pool, @NonNull() OutputBuffer buffer)Writes the given data to the muxer. voidrequestStop(int track)Requests that the engine stops. voidnotifyStopped(int track)Notifies that the encoder was stopped. -
-
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- poolbuffer- 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
-
-
-
-