DrainCommandHandler implements ICommandHandler { @Override public void handle() { plugin.drain(0); } DrainCommandHandler(MediaCodecPlugin plugin); @Override void handle();  }
@Test public void encoderShouldNotSwapBuffersIfEof() { VideoDecoder decoder = create.videoDecoder().construct(); ISurface surface = create.surface().construct(); Encoder encoder = create.videoEncoder().with(surface).construct(); decoder.drain(0); decoder.setOutputSurface(surface); encoder.getInputCommandQueue().dequeue(); new DrainCommandHandler(encoder).handle(); verify(surface, never()).awaitNewImage(); verify(surface, never()).swapBuffers(); }
@Test public void decoderShouldNotReleaseOutputBufferIfEof() { IMediaCodec mediaCodec = create.mediaCodec().construct(); VideoDecoder decoder = create.videoDecoder().with(mediaCodec).construct(); ISurface surface = create.surface().construct(); Encoder encoder = create.videoEncoder().with(surface).construct(); decoder.drain(0); decoder.setOutputSurface(surface); encoder.getInputCommandQueue().dequeue(); new DrainCommandHandler(encoder).handle(); verify(mediaCodec, never()).releaseOutputBuffer(anyInt(), anyBoolean()); }