[vlc-commits] [Git][videolan/vlc][master] dav1d: Don't always immediately drain all pending frames

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 27 10:17:32 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2d300b62 by Sebastian Dröge at 2023-01-27T09:48:20+00:00
dav1d: Don't always immediately drain all pending frames

By only draining up to a single frame per `dav1d_send_data()` call, up
to `max_frame_delay` frames are queued up in the decoder and decoded in
parallel. Previously the code would always drain all frames immediately,
which made frame threading not very useful.

In addition this also works around a deadlock in dav1d on certain
streams.

- - - - -


1 changed file:

- modules/codec/dav1d.c


Changes:

=====================================
modules/codec/dav1d.c
=====================================
@@ -365,8 +365,23 @@ static int Decode(decoder_t *dec, block_t *block)
                 decoder_QueueVideo(dec, pic);
                 ExtractCaptions(dec, &img);
                 dav1d_picture_unref(&img);
+
+                /* if not draining then break here and don't get further
+                 * decoded frames. this allows for proper frame threading
+                 * as otherwise all frames would be drained directly */
+                if(p_data != NULL && !b_eos)
+                    break;
+            }
+            else if (res == DAV1D_ERR(EAGAIN))
+            {
+                /* the decoder needs more data to be able to output something.
+                 * if there is more data pending, continue the loop below or
+                 * otherwise break and first read more data */
+                if (p_data && p_data->sz != 0)
+                    res = 0;
+                break;
             }
-            else if (res != DAV1D_ERR(EAGAIN))
+            else
             {
                 msg_Warn(dec, "Decoder error %d!", res);
                 b_output_error = true;
@@ -384,7 +399,7 @@ static int Decode(decoder_t *dec, block_t *block)
             b_draining = true;
             res = 0;
         }
-    } while (res == 0 || (p_data && p_data->sz != 0));
+    } while (res == 0 && ((p_data && p_data->sz != 0) || b_draining));
 
     if(p_data && p_data->sz > 0)
         dav1d_data_unref(p_data);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2d300b624ed9de89593895399546d065e0f2a3b7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2d300b624ed9de89593895399546d065e0f2a3b7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list