MediaCodec stalls after a period of time playing on Android

The log says

2025-04-23 10:32:07.577  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Stats over last 5065ms:
2025-04-23 10:32:07.577  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] ClientName: com.plutovr.electricmaple.standalone_client ComponentName: c2.android.avc.decoder
2025-04-23 10:32:07.577  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Qinput: 134, DQinput: 134 success out of 134 tries
2025-04-23 10:32:07.577  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Render: 103, Drop: 33, DQoutput: 136 success out of 165 tries
2025-04-23 10:32:07.577  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Avg Input Interval: 37ms, Avg Render Interval: 49ms
2025-04-23 10:32:12.598  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Stats over last 5021ms:
2025-04-23 10:32:12.599  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] ClientName: com.plutovr.electricmaple.standalone_client ComponentName: c2.android.avc.decoder
2025-04-23 10:32:12.599  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Qinput: 0, DQinput: 0 success out of 0 tries
2025-04-23 10:32:12.599  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Render: 0, Drop: 0, DQoutput: 0 success out of 50 tries
2025-04-23 10:32:17.621  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Stats over last 5022ms:
2025-04-23 10:32:17.621  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] ClientName: com.plutovr.electricmaple.standalone_client ComponentName: c2.android.avc.decoder
2025-04-23 10:32:17.621  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Qinput: 0, DQinput: 0 success out of 0 tries
2025-04-23 10:32:17.621  2416-2657  MediaCodec              com...ectricmaple.standalone_client  I  [mId: 0] [video-debug-dec] Render: 0, Drop: 0, DQoutput: 0 success out of 50 tries

My pipeline

"webrtcbin name=webrtc bundle-policy=max-bundle latency=0 ! "
	    "rtph264depay ! "
	    "h264parse ! "
	    "video/x-h264,stream-format=(string)byte-stream, alignment=(string)au,parsed=(boolean)true ! "
	    "amcviddec-omxgoogleh264decoder ! "
	    "glsinkbin name=glsink"

Has anyone met similar issues? Thanks in advance for any help.

1 Like

And eventually it will crash with

2025-04-23 10:38:52.218  2416-2856  GStreamer+...ssociation com...ectricmaple.standalone_client  E  0:35:18.293709139 0x77bf2f5c90 ../ext/sctp/sctpassociation.c:869:handle_notification:<GstSctpAssociation@0x766eec50b0> Event: SCTP_SEND_FAILED_EVENT (0)
2025-04-23 10:38:52.218  2416-2856  GST                     com...ectricmaple.standalone_client  E  ../ext/sctp/sctpassociation.c, handle_notification: Event: SCTP_SEND_FAILED_EVENT (0)

I suppose it is amcviddec-omxgoogleh264decoder to blame. I changed the decoder to decodebin3, which uses amcvideodec-omxqcomvideodecoderavc0 under the hood, and no more stalls and crashes now.

1 Like