My simple transcoding app hangs, code review requested

Andrey Utkin andrey.krieger.utkin at gmail.com
Tue Oct 1 13:16:20 PDT 2013


I have derived my code from "Hello world" of Gstreamer Application
Development Manual.
The source file is there: https://gist.github.com/krieger-od/6784332
Compiled with
gcc main.c -o gstreamer_test `pkg-config --cflags --libs
gstreamer-1.0` -O0 -g -ggdb
The application freezes, see its output and gdb backtrace below.
I think i missed some basic concept(s) because the intention is trivial.
Please anybody brave check my code.

Command and output:

./gstreamer_test ~/Downloads/big_buck_bunny_720p_h264.mov bbb_reenc.ts
Now playing: /home/krieger/Downloads/big_buck_bunny_720p_h264.mov
Running...
pad name 'video_0'
Dynamic pad created, linking demuxer/decoder
pad name 'audio_0'
Dynamic pad created, linking demuxer/decoder
<hangs there. Output file is 0 bytes length>


Packages versions: everything related seems 1.2.0

 # equery list '*gst*' | grep '[-]1'
media-libs/gst-plugins-bad-1.2.0
media-libs/gst-plugins-base-1.2.0
media-libs/gst-plugins-good-1.2.0
media-libs/gst-plugins-ugly-1.2.0
media-libs/gstreamer-1.2.0
media-plugins/gst-plugins-a52dec-1.0.5
media-plugins/gst-plugins-cdparanoia-1.0.5
media-plugins/gst-plugins-dts-1.0.5
media-plugins/gst-plugins-dvdread-1.0.5
media-plugins/gst-plugins-faad-1.0.5
media-plugins/gst-plugins-flac-1.0.5
media-plugins/gst-plugins-libav-1.2.0
media-plugins/gst-plugins-mad-1.0.5
media-plugins/gst-plugins-meta-1.0-r1
media-plugins/gst-plugins-mpeg2dec-1.0.5
media-plugins/gst-plugins-resindvd-1.0.5
media-plugins/gst-plugins-x264-1.2.0


GDB backtraces:
(gdb) thread apply all bt

Thread 6 (Thread 0x7fe20d30d700 (LWP 22426)):
#0  0x00007fe2135205ec in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fe2137b97af in g_cond_wait () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fe2119afc33 in gst_collect_pads_chain (pad=0x1a6a490,
parent=0x1a6e0c0, buffer=0x7fe208003d80)
    at gstcollectpads.c:2056
#3  0x00007fe213d20c51 in gst_pad_chain_data_unchecked (pad=0x1a6a490,
type=4112, data=0x7fe208003d80) at gstpad.c:3711
#4  0x00007fe213d21714 in gst_pad_push_data (pad=0x19eb860, type=4112,
data=0x7fe208003d80) at gstpad.c:3941
#5  0x00007fe213d21c65 in gst_pad_push (pad=0x19eb860,
buffer=0x7fe208003d80) at gstpad.c:4044
#6  0x00007fe2112c2de8 in gst_audio_encoder_finish_frame
(enc=0x1a5a370, buf=0x7fe208003d80, samples=1152)
    at gstaudioencoder.c:856
#7  0x00007fe2102f69d4 in gst_ffmpegaudenc_encode_audio () from
/usr/lib64/gstreamer-1.0/libgstlibav.so
#8  0x00007fe2102f6fa3 in gst_ffmpegaudenc_handle_frame () from
/usr/lib64/gstreamer-1.0/libgstlibav.so
#9  0x00007fe2112c35ab in gst_audio_encoder_push_buffers
(enc=0x1a5a370, force=0) at gstaudioencoder.c:976
#10 0x00007fe2112c50ba in gst_audio_encoder_chain (pad=0x19eb630,
parent=0x1a5a370, buffer=0x7fe208003830)
    at gstaudioencoder.c:1195
#11 0x00007fe213d20c51 in gst_pad_chain_data_unchecked (pad=0x19eb630,
type=4112, data=0x7fe208003830) at gstpad.c:3711
#12 0x00007fe213d21714 in gst_pad_push_data (pad=0x19eafa0, type=4112,
data=0x7fe208003830) at gstpad.c:3941
#13 0x00007fe213d21c65 in gst_pad_push (pad=0x19eafa0,
buffer=0x7fe208003830) at gstpad.c:4044
#14 0x00007fe2119a2946 in gst_base_transform_chain (pad=0x19ead70,
parent=0x1a51000, buffer=0x7fe208003940)
    at gstbasetransform.c:2237
#15 0x00007fe213d20c51 in gst_pad_chain_data_unchecked (pad=0x19ead70,
type=4112, data=0x7fe208003940) at gstpad.c:3711
#16 0x00007fe213d21714 in gst_pad_push_data (pad=0x19ea6e0, type=4112,
data=0x7fe208003940) at gstpad.c:3941
#17 0x00007fe213d21c65 in gst_pad_push (pad=0x19ea6e0,
buffer=0x7fe208003940) at gstpad.c:4044
#18 0x00007fe2112b7963 in gst_audio_decoder_push_forward
(dec=0x1a43110, buf=0x7fe208003940) at gstaudiodecoder.c:876
#19 0x00007fe2112b8163 in gst_audio_decoder_output (dec=0x1a43110,
buf=0x7fe208003940) at gstaudiodecoder.c:952
#20 0x00007fe2112b9215 in gst_audio_decoder_finish_frame
(dec=0x1a43110, buf=0x7fe208003940, frames=0)
    at gstaudiodecoder.c:1156
#21 0x00007fe2102fb4c5 in gst_ffmpegauddec_handle_frame () from
/usr/lib64/gstreamer-1.0/libgstlibav.so
#22 0x00007fe2112b97cb in gst_audio_decoder_handle_frame
(dec=0x1a43110, klass=0x1a41c90, buffer=0x7fe208003830)
    at gstaudiodecoder.c:1203
#23 0x00007fe2112b9c5d in gst_audio_decoder_push_buffers
(dec=0x1a43110, force=0) at gstaudiodecoder.c:1301
#24 0x00007fe2112ba196 in gst_audio_decoder_chain_forward
(dec=0x1a43110, buffer=0x0) at gstaudiodecoder.c:1404
#25 0x00007fe2112bba36 in gst_audio_decoder_chain (pad=0x19ea4b0,
parent=0x1a43110, buffer=0x7fe208003830)
    at gstaudiodecoder.c:1672
#26 0x00007fe213d20c51 in gst_pad_chain_data_unchecked (pad=0x19ea4b0,
type=4112, data=0x7fe208003830) at gstpad.c:3711
#27 0x00007fe213d21714 in gst_pad_push_data (pad=0x1a6af80, type=4112,
data=0x7fe208003830) at gstpad.c:3941
#28 0x00007fe213d21c65 in gst_pad_push (pad=0x1a6af80,
buffer=0x7fe208003830) at gstpad.c:4044
#29 0x00007fe211716f23 in gst_qtdemux_decorate_and_push_buffer
(qtdemux=0x19f8240, stream=<optimized out>,
    buf=0x7fe208003830, dts=21333333, pts=21333333, duration=21333333,
keyframe=1, position=21333333,
    byte_position=<optimized out>) at qtdemux.c:4109
#30 0x00007fe211727dd4 in gst_qtdemux_loop_state_movie
(qtdemux=0x19f8240) at qtdemux.c:4246
#31 gst_qtdemux_loop (pad=0x19ea280) at qtdemux.c:4323
#32 0x00007fe213d54d64 in gst_task_func (task=0x1a86000) at gsttask.c:316
#33 0x00007fe213d55e5f in default_func (tdata=0x1a75520,
pool=0x1898840) at gsttaskpool.c:70
---Type <return> to continue, or q <return> to quit---
#34 0x00007fe21379fbf8 in g_thread_pool_thread_proxy () from
/usr/lib64/libglib-2.0.so.0
#35 0x00007fe21379f325 in g_thread_proxy () from /usr/lib64/libglib-2.0.so.0
#36 0x00007fe21351bda6 in start_thread () from /lib64/libpthread.so.0
#37 0x00007fe213254abd in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7fe20ca31700 (LWP 22427)):
#0  0x00007fe2135205ec in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fe20f60c88b in frame_worker_thread () from
/usr/lib64/libavcodec.so.54
#2  0x00007fe21351bda6 in start_thread () from /lib64/libpthread.so.0
#3  0x00007fe213254abd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7fe207fff700 (LWP 22428)):
#0  0x00007fe2135205ec in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fe20f60c88b in frame_worker_thread () from
/usr/lib64/libavcodec.so.54
#2  0x00007fe21351bda6 in start_thread () from /lib64/libpthread.so.0
#3  0x00007fe213254abd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7fe2077fe700 (LWP 22429)):
#0  0x00007fe2135205ec in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fe20f60c88b in frame_worker_thread () from
/usr/lib64/libavcodec.so.54
#2  0x00007fe21351bda6 in start_thread () from /lib64/libpthread.so.0
#3  0x00007fe213254abd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fe206ffd700 (LWP 22430)):
#0  0x00007fe2135205ec in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fe20f60c88b in frame_worker_thread () from
/usr/lib64/libavcodec.so.54
#2  0x00007fe21351bda6 in start_thread () from /lib64/libpthread.so.0
#3  0x00007fe213254abd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fe2141bb700 (LWP 22425)):
#0  0x00007fe21324bb73 in poll () from /lib64/libc.so.6
#1  0x00007fe21377b8d6 in g_main_context_iterate.clone.6 () from
/usr/lib64/libglib-2.0.so.0
#2  0x00007fe21377bd2a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#3  0x0000000000401764 in main (argc=3, argv=0x7fff3f0f3728) at main.c:157

-- 
Andrey Utkin


More information about the gstreamer-devel mailing list