Skip to content
  • Ursula Maplehurst's avatar
    androidmedia: when flushing, better handle IllegalStateException received from getOutputBuffer · 236398ee
    Ursula Maplehurst authored and Sebastian Dröge's avatar Sebastian Dröge committed
    1. Similar to 880f3d8a, don't consider not getting an output buffer as
       an error during flushing. I've seen the following sometimes when
       encoding:
    
       W GStreamer+amcvideoenc: java.lang.IllegalStateException
       W GStreamer+amcvideoenc:         at android.media.MediaCodec.getBuffer(Native Method)
       W GStreamer+amcvideoenc:         at android.media.MediaCodec.getOutputBuffer(MediaCodec.java:2886)
    
    2. For amcvideodec/enc, call _find_nearest_frame (which grabs a fresh
       reference on a GstVideoCodecFrame) after we have an output buffer,
       so as to not leak the reference, in case getting an output buffer
       fails.
    
       Otherwise, if we get an error grabbing the output buffer, we leak
       the reference to the frame. This can cause issues with a
       v4l2bufferpool feeding the encoder not being able to clean itself
       up properly due to buffers still being marked as in-use.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791258
    236398ee