vaapih264enc: Pipeline hangs when seeking
Looks like: https://bugzilla.gnome.org/show_bug.cgi?id=767176
I take the same pipeline
gst-launch-1.0 filesrc location=file.mkv ! decodebin ! navseek ! vaapih264enc ! decodebin ! vaapisink
but when seeking, pipeline hangs with following log:
0:00:03.340889630 26272 0x7f64d85a4860 INFO GST_EVENT gstevent.c:1363:gst_event_new_seek: creating seek rate 1.000000, format TIME, flags 3, start_type 1, start 0:00:08.670708333, stop_type 0, stop 99:99:99.999999999
0:00:03.340962439 26272 0x7f64d85a4860 INFO default gstsegment.c:385:gst_segment_do_seek: segment updated: time segment start=0:00:08.670708333, offset=0:00:00.000000000, stop=2:32:33.472000000, rate=1.000000, applied_rate=1.000000, flags=0x01, time=0:00:08.670708333, base=0:00:00.000000000, position 0:00:08.670708333, duration 2:32:33.472000000
0:00:03.341139363 26272 0x7f64f81baaa0 INFO task gsttask.c:368:gst_task_func:<queue1:src> Task going to paused
0:00:03.341196405 26272 0x7f64f05aa460 INFO task gsttask.c:368:gst_task_func:<vaapiencodeh264-0:src> Task going to paused
0:00:03.341203549 26272 0x7f64d85a4860 INFO GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<vaapisink0> notifying about state-changed PAUSED to PAUSED (PAUSED pending)
0:00:03.341289440 26272 0x7f64d85a4860 INFO GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<pipeline0> notifying about state-changed PAUSED to PAUSED (PAUSED pending)
0:00:03.341422257 26272 0x55ea198311e0 INFO task gsttask.c:368:gst_task_func:<matroskademux0:sink> Task going to paused
0:00:03.341749823 26272 0x7f65080ad4c0 INFO task gsttask.c:368:gst_task_func:<multiqueue0:src_0> Task going to paused
Other infos:
- If I use x264enc, no problem
- When seek without flushing, no problem (tested in my code)
- If I increase log level (export GST_DEBUG=6), seeks can work, but not always. Logs seems to show infinite loop
Tested on gstreamer versions 1.18.4 and 1.20 (Ubuntu), on Intel AppoloLake & TigerLake
[edit] Logs with export GST_DEBUG=vaapi:6
0:00:02.728303960 34613 0x7fb6dc5a8060 DEBUG vaapipostproc gstvaapipostproc.c:1988:gst_vaapipostproc_sink_event:<vaapipostproc0> handling flush-start event
0:00:02.728368360 34613 0x7fb6dc5a8060 DEBUG vaapipostproc gstvaapipostproc.c:1988:gst_vaapipostproc_sink_event:<vaapipostproc1> handling flush-start event
0:00:02.728390466 34613 0x7fb6dc5a8060 DEBUG vaapisink gstvaapisink.c:1750:gst_vaapisink_event:<vaapisink0> handling event flush-start
0:00:02.728613624 34613 0x7fb6fc5ad060 LOG vaapidecode gstvaapidecode.c:709:gst_vaapidecode_push_decoded_frame:<vaapidecode1> downstream element rejected the frame (flushing [-2])
0:00:02.728661119 34613 0x7fb6fc5ad060 LOG vaapiencode gstvaapiencode.c:328:gst_vaapiencode_buffer_loop:<vaapiencodeh264-0> pausing task, reason flushing
0:00:02.728780475 34613 0x7fb7080ac4c0 LOG vaapidecode gstvaapidecode.c:709:gst_vaapidecode_push_decoded_frame:<vaapidecode0> downstream element rejected the frame (flushing [-2])
Edited by Víctor Manuel Jáquez Leal