mpeg2dec: Failed "uncleanly" upon resolution change (e.g. video track change)
Submitted by Fabien Vallée
Link to original bug (#740368)
Description
If a media has different video tracks, set the playbin "current-video" property allow to select the current track displayed
g_object_set (playbin, "current-video", index, NULL);
This is working perfectly fine if the different tracks have the same width/height.
However, if the width/height change, gstreamer will fail with the following error
setting current video stream to 1
ERROR default video-frame.c:152:gst_video_frame_map_id: invalid buffer size 540000 < 556800
ERROR mpeg2dec gstmpeg2dec.c:563:gst_mpeg2dec_alloc_buffer:<mpeg2dec0>
Failed to map frame
WARN multiqueue gstmultiqueue.c:1571:gst_multi_queue_loop:<multiqueue0>
error: Internal data stream error.
WARN multiqueue gstmultiqueue.c:1571:gst_multi_queue_loop:<multiqueue0>
error: streaming stopped, reason error
Error received from element multiqueue0: Internal data stream error.
( as reported using GST_DEBUG=*:3)
Please find attached a test application that can be used to reproduce the bug, based on http://docs.gstreamer.com/plugins/viewsource/viewpagesrc.action?pageId=327794
I've made the following changes:
- update to be compatible with gst 1.0 (playbin2 -> playbin)
- uri of media comes from command line
- console prompt is used to select video (instead of text)
Hopefully the attached code can be compiled directly using cmake (cmake file includes).
Steps to reproduce the issue:
- test with a video containing 2 video tracks (same width / height):
./multitrack http://trac.webkit.org/export/176315/trunk/LayoutTests/media/content/two-audio-and-video-tracks.mkv
--> press 0 or 1 in console allow to select the video track, it works perfectly fine.
- test with a video containing 3 video tracks with different w/h:
GST_DEBUG=*:3 ./multitrack file://$PWD/multivideo.mp4
gstreamer will fail when changing the video track.
multivideo.mp4 is included in attached code and has been generated using ffmpeg:
ffmpeg -loop 1 -i image000.png -c:v libx264 -t 30 -pix_fmt yuv420p blue.mp4
ffmpeg -loop 1 -i image002.png -c:v libx264 -t 30 -pix_fmt yuv420p purple.mp4
ffmpeg -loop 1 -i image001.png -c:v libx264 -t 30 -pix_fmt yuv420p green.mp4
ffmpeg -i green.mp4 -i blue.mp4 -i purple.mp4 -map 0:0 -map 1:0 -map 2:0 -metadata:s:v:0 language=eng -metadata:s:v:1 language=fre -metadata:s:v:1 language=deu -c copy -c:v mpeg2video multivideo.mp4
(mplayer and SMPlayer are able to select multivideo.mp4 video tracks).
Version: 1.4.4