@Test public void configureDecoderWithChangedMediaFormat() throws RuntimeException { IOutput twoFilesMediaSource = create.multipleMediaSource() .with(create.mediaSource().with(1).frame() .with(create.videoFormat().withFrameSize(1024, 768).withBitRate(100).construct())) .with(create.mediaSource().with(1).frame() .with(create.videoFormat().withFrameSize(1024, 768).withBitRate(250).construct())) .construct(); IMediaCodec mediaCodec = create.mediaCodec().construct(); VideoDecoder decoder = create.videoDecoder().with(mediaCodec).construct(); twoFilesMediaSource.start(); decoder.start(); decoder.fillCommandQueues(); PushDataCommandHandler pushDataCommandHandler = new PushDataCommandHandler(twoFilesMediaSource, decoder, decoder); pushDataCommandHandler.handle(); OutputFormatChangedHandler outputFormatChangedHandler = new OutputFormatChangedHandler(twoFilesMediaSource, decoder, decoder); outputFormatChangedHandler.handle(); pushDataCommandHandler.handle(); ArgumentCaptor<VideoFormat> mediaFormatCaptor = ArgumentCaptor.forClass(VideoFormat.class); verify(mediaCodec).configure(mediaFormatCaptor.capture(), any(ISurfaceWrapper.class), anyInt()); assertEquals(250, mediaFormatCaptor.getValue().getVideoBitRateInKBytes()); }
@Override public void handle() { Frame frame = inputWithAllocator.findFreeFrame(); if (frame == null) { restoreCommands(); return; } output.pull(frame); plugin.push(frame); plugin.checkIfOutputQueueHasData(); }
PushDataCommandHandler implements ICommandHandler { @Override public void handle() { Frame frame = inputWithAllocator.findFreeFrame(); if (frame == null) { restoreCommands(); return; } output.pull(frame); plugin.push(frame); plugin.checkIfOutputQueueHasData(); } }
PushDataCommandHandler implements ICommandHandler { @Override public void handle() { Frame frame = inputWithAllocator.findFreeFrame(); if (frame == null) { restoreCommands(); return; } output.pull(frame); plugin.push(frame); plugin.checkIfOutputQueueHasData(); } PushDataCommandHandler(IOutput output, Plugin plugin, IFrameAllocator frameAllocator); }
PushDataCommandHandler implements ICommandHandler { @Override public void handle() { Frame frame = inputWithAllocator.findFreeFrame(); if (frame == null) { restoreCommands(); return; } output.pull(frame); plugin.push(frame); plugin.checkIfOutputQueueHasData(); } PushDataCommandHandler(IOutput output, Plugin plugin, IFrameAllocator frameAllocator); @Override void handle(); }
PushDataCommandHandler implements ICommandHandler { @Override public void handle() { Frame frame = inputWithAllocator.findFreeFrame(); if (frame == null) { restoreCommands(); return; } output.pull(frame); plugin.push(frame); plugin.checkIfOutputQueueHasData(); } PushDataCommandHandler(IOutput output, Plugin plugin, IFrameAllocator frameAllocator); @Override void handle();  }