Gstreamer not releasing HDMI-in drivers

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu server 24.02 fenix 1.7.5

Please describe your issue below:

`When i use Gstreamer to encode a mpeg file from my hdmi source (a panasonic lumix camera), it works perfectly after a fresh reboot. I’m using the following command:

gst-launch-1.0 -e
mp4mux name=mux ! filesink location=test_video_audio_3.mp4
v4l2src device=/dev/video71 ! video/x-raw,width=1920,height=1080,framerate=30/1 ! amlvenc ! h265parse ! queue ! mux.video_0
alsasrc device=“hw:0,0” ! audio/x-raw,rate=48000,format=S16LE,channels=2 ! audioconvert ! voaacenc ! aacparse ! queue ! mux.audio_0

File is created perfectly in this case when i stop Gstreamer with ctrl-C or ctrl-\\. However, if i try to run the same command again, it hangs. Below is the gstreamer output of this second run; below that is the final few lines of dmesg output.
I tried running hdmiin-demo after the first run to see if that would reset the sockets/drivers/subroutines, but hdmiin-demo just hangs as well without outputting any image to HDMI-out. I’ve included the final few lines of dmesg output from this attempt as well.
I get the same result even if i strip the Gst command to bare minimum, or if i pkill processes like hdmictrl. There is definitely something that is not being released when Gstreamer stops.

Post a console log of your issue below:

gstreamer output (hangs on last line):


Setting pipeline to PAUSED ...
[API:aml_v4l2src_connect:280]Enter, devname : /dev/video71
driver : vdinvideo
device : mesont7
bus_info : vdin1 v4l2
version : 539099424
strcmp cap.driver: vdinvideo
func_name: aml_src_get_hdmi_method
initialize func addr: 0x7f82c9109c
finalize func addr: 0x7f82c91430
start func addr: 0x7f82c915f8
stop func addr: 0x7f82c9174c
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:135:hdmi_src_initialize]enter
khadas      1510  0.0  0.0   2380   820 pts/0    S+   19:52   0:00 sh -c -- ps -aux | grep hdmictrl
khadas      1512  0.0  0.0   6140  2016 pts/0    S+   19:52   0:00 grep hdmictrl
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:101:hdmi_src_obtain_devname]enter
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:112:hdmi_src_obtain_devname]hdmi_src_obtain_devname, pid=1513
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:120:hdmi_src_obtain_devname]hdmi_src_obtain_devname end, pid=1513
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:112:hdmi_src_obtain_devname]hdmi_src_obtain_devname, pid=0
[2025-10-08 19:52:12]  DEBUG  [amlv4l2src hdmisrc.c:116:hdmi_src_obtain_devname]ready to execl /usr/bin/hdmictrl, pid=0
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:304:main]enter, prepare enter hdmi_rx_svctx_init
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:256:hdmi_rx_svctx_init]enter
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:264:hdmi_rx_svctx_init]prepare get the GetInstance
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:271:hdmi_rx_svctx_init]go hdmi_rx_svctx_perform_connect
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:202:hdmi_rx_svctx_perform_connect]enter
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:229:hdmi_rx_svctx_perform_connect][13207567]UNIX domain socke[2025-10-08 19:52:13]  DEBUG  [amlv4l2src common/common.c:70:udp_sock_create][13246609][/tmp/hdmi-rx0] start connet (/tmp/hdmi-rx0) bound
ct
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmisrc.c:130:hdmi_src_obtain_devname]exit
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:238:hdmi_rx_svctx_perform_connect][13334607]Accepting connect[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmisrc.c:142:hdmi_src_initialize]send_buffer:fd:9 buf:connect
ions,get the client_unix_len: 110
change_divide_framerate, L74, dev /dev/video71, change_frame 1
change_divide_framerate L93 Set framerate div 2 success
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmisrc.c:151:hdmi_src_initialize]exit
[API:aml_v4l2src_connect:332]Exit, HDMI RX
devname : /dev/video71
driver : vdinvideo
device : mesont7
bus_info : vdin1 v4l2
version : 539099424
hdmirx tvin-port use 0
[API:aml_v4l2src_streamon:384]Enter
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmisrc.c:180:hdmi_src_start]enter
unix  2      [ ACC ]     STREAM     LISTENING     14188    /tmp/hdmi-rx0
unix  3      [ ]         STREAM     CONNECTED     14189    /tmp/hdmi-rx0
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:248:hdmi_rx_svctx_perform_connect]g_t_svctx prepare get the connect_socker_fd 10
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:251:hdmi_rx_svctx_perform_connect]exit
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:278:hdmi_rx_svctx_init]exit
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:311:main]prepare enter setTvEventCallback
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:314:main]prepare enter process_socket_thread
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:139:process_socket_thread]enter
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:144:process_socket_thread]hdmirxsrc is hdmi2
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:156:process_socket_thread]HDMISRC is hdmi2
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:165:process_socket_thread]e_currentsource = 6
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:169:process_socket_thread]loop wait recv cmd
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:171:process_socket_thread]recv_buffer = connect
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:172:process_socket_thread]r = 32 errno = 0
[2025-10-08 19:52:13]  DEBUG  [amlv4l2src hdmictrl.c:183:process_socket_thread]Enter connect_hdmi


--DMESG OUTPUT--
[  678.399559] dp_buf:[1:7]di buf_mgr free
[  678.399579] v4lvid: dbg: v4lvideo open
[  678.399616] v4lvid: dbg: vidioc_close!!!!
[  678.399621] dp_buf:[1:8]di buf_mgr free
[  678.414705] vdin-v4l: vdin_v4l2_open
[  678.414731] video71: VIDIOC_QUERYCAP: driver=vdinvideo, card=mesont7, bus=vdin1 v4l2, version=0x20220120, capabilities=0x85201000, device_caps=0x05201000
[  678.414801] vdin-v4l: vdin_v4l2_release
[  678.540621] vdin-v4l: vdin_v4l2_open
[  678.540652] video71: VIDIOC_S_CTRL: id=0x982a08, value=2
[  678.540701] vdin-v4l: vdin_v4l2_release
[  678.540819] vdin-v4l: vdin_v4l2_open
[  678.540834] video71: VIDIOC_QUERYCAP: driver=vdinvideo, card=mesont7, bus=vdin1 v4l2, version=0x20220120, capabilities=0x85201000, device_caps=0x05201000
[  678.540917] vdin-v4l: vdin_v4l2_release
[  678.540970] vdin-v4l: vdin_v4l2_open
[  678.540983] video71: VIDIOC_QUERYCAP: driver=vdinvideo, card=mesont7, bus=vdin1 v4l2, version=0x20220120, capabilities=0x85201000, device_caps=0x05201000
[  678.541013] vdin-v4l: vdin_vidioc_s_input current port:0xa002(VIU1_WB0_VD1)
[  678.541020] video71: VIDIOC_S_INPUT: value=0
[  678.541037] video71: VIDIOC_ENUMINPUT: index=0, name=VIU1_WB0_VD1, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541307] video71: VIDIOC_ENUMINPUT: index=1, name=VIU1_WB0_VD2, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541335] video71: VIDIOC_ENUMINPUT: index=2, name=TVIN_PORT_NULL, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541360] video71: VIDIOC_ENUMINPUT: index=3, name=VIU1_WB0_OSD1, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541383] video71: VIDIOC_ENUMINPUT: index=4, name=VIU1_WB0_OSD2, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541407] video71: VIDIOC_ENUMINPUT: index=5, name=TVIN_PORT_NULL, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541430] video71: VIDIOC_ENUMINPUT: index=6, name=VIU1_WB0_VPP, type=0, audioset=0x0, tuner=0, std=0x00ffffff, status=0x0, capabilities=0x0
[  678.541454] vdin-v4l: vdin_vidioc_enum_input index:7,v4l2 port num = 7,end
[  678.541460] video71: VIDIOC_ENUMINPUT: error -22: index=7, name=, type=0, audioset=0x0, tuner=0, std=0x00000000, status=0x0, capabilities=0x0
[  678.541484] video71: VIDIOC_ENUMSTD: error -25: index=0, id=0x0, name=, fps=0/0, framelines=0
[  678.541505] video71: VIDIOC_QUERYCTRL: error -25: id=0x80000000, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[  678.541539] video71: VIDIOC_QUERYCTRL: error -25: id=0x980900, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[  678.541562] video71: VIDIOC_QUERYCTRL: error -25: id=0x8000000, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[  678.541589] video71: VIDIOC_G_STD: error -25: std=0x00000000
[  678.541609] video71: VIDIOC_G_INPUT: value=0


-- hdmiin-demo dmesg output--
[  786.674651] binder: 1469:1469 BC_INCREFS_DONE node 64 has no pending increfs request
[  786.674682] binder: 1469:1469 BC_ACQUIRE_DONE node 64 has no pending acquire request
[  786.674695] binder: 1469:1469 BC_FREE_BUFFER u0000007f94e42000 no match
[  786.674719] binder: 1469:1469 got new transaction with bad transaction stack, transaction 67 has target 1007:1053
[  786.674733] binder: 1469:1469 transaction failed 29201/-71, size 12-0 line 3255
[  786.705815] binder: 1469:1469 BC_INCREFS_DONE node 64 has no pending increfs request
[  786.705845] binder: 1469:1469 BC_ACQUIRE_DONE node 64 has no pending acquire request
[  786.705861] binder: 1469:1469 BC_FREE_BUFFER u0000007f94e42000 no match
[  786.705889] binder: 1469:1469 got new transaction with bad transaction stack, transaction 67 has target 1007:1053
[  786.705908] binder: 1469:1469 transaction failed 29201/-71, size 12-0 line 3255
[  786.705990] binder: 1469:1469 BC_INCREFS_DONE node 64 has no pending increfs request
[  786.706008] binder: 1469:1469 BC_ACQUIRE_DONE node 64 has no pending acquire request
[  786.706021] binder: 1469:1469 BC_FREE_BUFFER u0000007f94e42000 no match
[  786.706039] binder: 1469:1469 got new transaction with bad transaction stack, transaction 67 has target 1007:1053
[  786.706055] binder: 1469:1469 transaction failed 29201/-71, size 12-0 line 3255
[  786.715475] binder: release 1469:1469 transaction 67 out, still active
[  786.715501] binder: undelivered TRANSACTION_ERROR: 29201

Anyone else having this issue? This is on basically a fresh image install of the OS through oowow on the eMMC.
Also worth noting, all this output was seen on my SSH session from another pc. However, on the local VIM4 monitor, there was occasional output to the terminal. I noticed that after the first Gstreamer run, if I disconnected my HDMI source from HDMI-in, I would see the following output to the local terminal:

amlvideo2_receiver_event_fun,6685stop thread

This behavior is NOT present after bootup. Perhaps amlvideo2 needs to be reset?

After fiddling with it for a while, it seems that there is a TvClient that remains open and locks up the hdmi-in port. It’s released by the hdmiin-demo but not by gstreamer-aml.
I made the following cpp program to release the TvClient instance. As long as i run this program after every gstreamer instance finishes, I can continue to run gstreamer commands. Think you guys could integrate this into gstreamer natively? Or, tell me what I’m doing wrong, that I need this?

#include “TvClient.h”
#include <stdio.h>

int main() {
printf(“Attempting to get TV Client instance…\n”);
TvClient *tv = TvClient::GetInstance();

if (tv) {
    printf("Instance obtained. Calling Release()...\n");
    tv->Release();
    printf("Release() called. Hardware should be free.\n");
} else {
    fprintf(stderr, "Error: Could not get TvClient instance.\n");
    return 1;
}

return 0;
}

Hello @sotaskimmer

I checked on my side with the below command and Ctrl + C to stop multi times and also works well, could you check on your side ?

gst-launch-1.0 v4l2src device=/dev/video71 io-mode=dmabuf num-buffers=300 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=interleaved ! amlvenc ! h264parse ! qtmux ! filesink location=/tmp/test71.mp4

Well I’m not sure what happened, but everything is working now. All I did was update my system packages while installing some other things, and add io-mode=dmabuf to my gstreamer command. Maybe that’s all that was missing? I thought I tried it before but who knows.
Thanks for the help!

1 Like

Actually, there is still a problem!

Your gstreamer example works fine every time, but my mine still locks up resources sometimes. I’ve noticed that if gstreamer prints the following, then resources are freed.

Freeing pipeline …
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:99:_hdmi_rc_svctx_release]stoptv is ok
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:101:_hdmi_rc_svctx_release]ReleaseInstance is ok
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:110:_hdmi_rc_svctx_release]exit _hdmi_rc_svctx_release
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:196:process_socket_thread]exit
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:323:main]exit process_socket_thread
[2025-10-09 15:52:54] DEBUG [amlv4l2src hdmictrl.c:328:main]exit

However, most of the time, my commands only print

Freeing pipeline …

and then exit. If this happens, the resources are locked, and if i try to run it again, it hangs on

[2025-10-09 15:52:33] DEBUG [amlv4l2src hdmictrl.c:171:process_socket_thread]recv_buffer = connect
[2025-10-09 15:52:33] DEBUG [amlv4l2src hdmictrl.c:172:process_socket_thread]r = 32 errno = 0
[2025-10-09 15:52:33] DEBUG [amlv4l2src hdmictrl.c:183:process_socket_thread]Enter connect_hdmi

I have tried and tried to find a pattern for when it will work or won’t work. I try after fresh reboot, after running your example commands, before/after running hdmiin-demo… it is always unpredictable. Is there some race condition in the code?

Ok, even though it is unpredictable, it seems to only happen with the "alsasrc device=“hw:0,0” (the default address for the hdmi-in audio). For a while, I got it to consistently freeze on “Freeing pipeline…” with this audio segment

alsasrc device=“hw:0,0” ! audio/x-raw,rate=48000,format=S16LE,channels=2 ! audioconvert ! voaacenc bitrate=192000 ! aacparse ! queue ! mux.

But it would work consistently with this segment (only changed the source)

audiotestsrc is-live=true ! audio/x-raw,rate=48000,format=S16LE,channels=2 ! audioconvert ! voaacenc bitrate=192000 ! aacparse ! queue ! mux.

Hello @sotaskimmer

Could you provide the full pipeline you used on your side?

  • The one works
  • The one not work

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.