GNOME Bugzilla – Bug 137504
mpeg2dec fails on 422 encoded material
Last modified: 2004-12-22 21:47:04 UTC
I am currently working on an MXF demuxer that uses gstreamer, but I am running into a problem with this pipeline (using gstreamer version 0.8.0): filesrc location=file.mxf ! mxfdemux ! mpeg2dec ! xvimagesink The pipeline segfaults in mpeg2dec. If I run this pipeline (or something like): filesrc location=file.mxf ! mxfdemux ! fdsink fd=1 | mpeg2dec /proc/self/fd/1 all goes fine. I have been analyzing the problem using valgrind at it seems that on my system (Fedora core 1) the mpeg2dec is overrunning its buffers when decoding. Valgrinds output from the simple pipeline: filesrc location=file.mpeg2 ! mpeg2dec ! xvimagesink if gives me the output: Invalid write of size 8 ==22720== at 0x4C16D40: mpeg2_idct_copy_mmxext (idct_mmx.c:613) ==22720== by 0x4C068CE: mpeg2_slice (slice.c:954) ==22720== by 0x4C04704: mpeg2_parse (decode.c:188) ==22720== by 0x6501FE: gst_mpeg2dec_chain (gstmpeg2dec.c:478) ==22720== by 0xD9F6A4: gst_pad_push (gstpad.c:3032) ==22720== by 0xE700C2: get_group_schedule_function (gstoptimalscheduler.c:1138) ==22720== by 0xE6FC41: schedule_group (gstoptimalscheduler.c:1007) ==22720== by 0xE6FCF7: gst_opt_scheduler_schedule_run_queue (gstoptimalscheduler.c:1050) ==22720== Address 0x3ACD524 is 0 bytes after a block of size 656640 alloc'd ==22720== at 0xE8A68E: malloc (vg_replace_malloc.c:153) ==22720== by 0xAF38C6: g_malloc (in /usr/lib/libglib-2.0.so.0.200.3) ==22720== by 0xD85B9F: gst_buffer_new_and_alloc (gstbuffer.c:224) ==22720== by 0x64FE04: gst_mpeg2dec_alloc_buffer (gstmpeg2dec.c:293) ==22720== by 0x6503CD: gst_mpeg2dec_chain (gstmpeg2dec.c:508) ==22720== by 0xD9F6A4: gst_pad_push (gstpad.c:3032) ==22720== by 0xE700C2: get_group_schedule_function (gstoptimalscheduler.c:1138) ==22720== by 0xE6FC41: schedule_group (gstoptimalscheduler.c:1007) informing us that the buffer being read from that was allocated by 'gst_mpeg2dec_alloc_buffer' is being accessed invalidly. I checked mpeg2dec command line tool for processing the same file, and I get no such error.
The problem appears to be beacuse the content is encoded 422 (not 420 as assumed by the mpeg2dec plugin). This problem can be reproduced in 100% of the 422 content that I have tried.
the mpeg2dec library should be able to handle 422 material. the caps need to be updated to handle 422 however.
Created attachment 25882 [details] [review] patch for gstmpeg2dec.c
Created attachment 25883 [details] [review] Patch for gstmpeg2dec.h
I have attched patches for gstmpeg2dec.[ch] that fixes the problem of 422 playback here whilst still allowing 420 playback of standard content. Could this be tested please with a view to applying to cvs-head?
Can you provide a sample file with 422-material for us to test? Video-only elementary streams are ok, mpeg1videoparse can parse those.
Applied. We still need a test file.