diff mbox series

[FFmpeg-devel,23/25] fftools/ffmpeg_demux: factorize signalling end of demuxing

Message ID 20220803135844.16662-23-anton@khirnov.net
State Accepted
Commit de9fb9fba7f6a7002ade2fe8c306a85fbf83e97d
Headers show
Series [FFmpeg-devel,01/25] fftools/ffmpeg_opt: move adding attachments out of open_output_file() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Aug. 3, 2022, 1:58 p.m. UTC
---
 fftools/ffmpeg_demux.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index e02d2d9656..be734be581 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -18,6 +18,7 @@ 
 
 #include "ffmpeg.h"
 
+#include "libavutil/avassert.h"
 #include "libavutil/error.h"
 #include "libavutil/time.h"
 #include "libavutil/timestamp.h"
@@ -142,7 +143,6 @@  static void *input_thread(void *arg)
                 /* fallthrough to the error path */
             }
 
-            av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
             break;
         }
 
@@ -162,7 +162,7 @@  static void *input_thread(void *arg)
         msg.pkt = av_packet_alloc();
         if (!msg.pkt) {
             av_packet_unref(pkt);
-            av_thread_message_queue_set_err_recv(f->in_thread_queue, AVERROR(ENOMEM));
+            ret = AVERROR(ENOMEM);
             break;
         }
         av_packet_move_ref(msg.pkt, pkt);
@@ -181,11 +181,13 @@  static void *input_thread(void *arg)
                        "Unable to send packet to main thread: %s\n",
                        av_err2str(ret));
             av_packet_free(&msg.pkt);
-            av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
             break;
         }
     }
 
+    av_assert0(ret < 0);
+    av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
+
     return NULL;
 }