Преглед на файлове

bin/app/java/videodecode: skip empty output buffers during decoder EOS handling

shayan13g преди 1 седмица
родител
ревизия
2d5faebb1b
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      bin/app/java/videodecode/VideoDecoder.java

+ 2 - 2
bin/app/java/videodecode/VideoDecoder.java

@@ -223,11 +223,11 @@ public class VideoDecoder {
         if (outputBufferId >= 0) {
         if (outputBufferId >= 0) {
             // New frame to read
             // New frame to read
             ByteBuffer outputBuffer = decoder.getOutputBuffer(outputBufferId);
             ByteBuffer outputBuffer = decoder.getOutputBuffer(outputBufferId);
-            if (outputBuffer != null) {
+            if (outputBuffer != null && bufferInfo.size > 0) {
                 processOutputBuffer(outputBuffer, bufferInfo.offset, bufferInfo.size);
                 processOutputBuffer(outputBuffer, bufferInfo.offset, bufferInfo.size);
             }
             }
             decoder.releaseOutputBuffer(outputBufferId, false);
             decoder.releaseOutputBuffer(outputBufferId, false);
-            return 1;
+            return bufferInfo.size > 0 ? 1 : 0;
         } else if (outputBufferId == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
         } else if (outputBufferId == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
             // Ready to read the output format
             // Ready to read the output format
             MediaFormat newFormat = decoder.getOutputFormat();
             MediaFormat newFormat = decoder.getOutputFormat();