After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679878 - [0.11][videodecoder] Need explicit negotiation method
[0.11][videodecoder] Need explicit negotiation method
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.11.x
Other Linux
: Normal major
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 680194
 
 
Reported: 2012-07-13 17:13 UTC by Tim-Philipp Müller
Modified: 2013-12-02 12:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
videodecoder: Expose _negotiate function (3.67 KB, patch)
2012-07-18 13:37 UTC, Edward Hervey
none Details | Review

Description Tim-Philipp Müller 2012-07-13 17:13:32 UTC
Starting program: /home/tpm/gst/0.11/gstreamer/tools/.libs/lt-gst-launch-1.0 filesrc location=/home/tpm/samples/misc/331301-xgl-gentoo-lycos-mpeg2dec-cropping.avi \! decodebin \! video/x-raw \! fakesink
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Setting pipeline to PAUSED ...
[New Thread 0x7ffff409e700 (LWP 20836)]
Pipeline is PREROLLING ...
[New Thread 0x7ffff2acd700 (LWP 20837)]
[New Thread 0x7ffff22cc700 (LWP 20838)]
Redistribute latency...

** (gst-launch-1.0:20833): CRITICAL **: gst_video_decoder_alloc_output_frame: assertion `frame->output_buffer == NULL' failed

Program received signal SIGTRAP, Trace/breakpoint trap.

Thread 140737256408832 (LWP 20838)

  • #0 g_logv
    at /tmp/buildd/glib2.0-2.32.3/./glib/gmessages.h line 101
  • #1 g_log
    at /tmp/buildd/glib2.0-2.32.3/./glib/gmessages.c line 792
  • #2 g_return_if_fail_warning
    at /tmp/buildd/glib2.0-2.32.3/./glib/gmessages.c line 801
  • #3 gst_video_decoder_alloc_output_frame
    at gstvideodecoder.c line 2829
  • #4 gst_mpeg2dec_crop_buffer
    at gstmpeg2dec.c line 332
  • #5 handle_slice
    at gstmpeg2dec.c line 879
  • #6 gst_mpeg2dec_handle_frame
    at gstmpeg2dec.c line 964
  • #7 gst_video_decoder_decode_frame
    at gstvideodecoder.c line 2460
  • #8 gst_video_decoder_chain_forward
    at gstvideodecoder.c line 1616
  • #9 gst_video_decoder_chain
    at gstvideodecoder.c line 1860
  • #10 gst_pad_chain_data_unchecked
    at gstpad.c line 3588
  • #11 gst_pad_push_data
    at gstpad.c line 3801
  • #12 gst_pad_push
    at gstpad.c line 3904
  • #13 gst_base_parse_push_frame
    at gstbaseparse.c line 2080
  • #14 gst_base_parse_handle_and_push_frame
    at gstbaseparse.c line 1905
  • #15 gst_base_parse_finish_frame
    at gstbaseparse.c line 2200
  • #16 gst_mpegv_parse_handle_frame
    at gstmpegvideoparse.c line 602
  • #17 gst_base_parse_handle_buffer
    at gstbaseparse.c line 1770
  • #18 gst_base_parse_chain
    at gstbaseparse.c line 2589
  • #19 gst_pad_chain_data_unchecked
    at gstpad.c line 3588
  • #20 gst_pad_push_data
    at gstpad.c line 3801
  • #21 gst_pad_push
    at gstpad.c line 3904
  • #22 gst_single_queue_push_one
    at gstmultiqueue.c line 1057
  • #23 gst_multi_queue_loop
    at gstmultiqueue.c line 1303
  • #24 gst_task_func
    at gsttask.c line 316
  • #25 g_thread_pool_thread_proxy
    at /tmp/buildd/glib2.0-2.32.3/./glib/gthreadpool.c line 309
  • #26 g_thread_proxy
    at /tmp/buildd/glib2.0-2.32.3/./glib/gthread.c line 801
  • #27 start_thread
    at pthread_create.c line 304
  • #28 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #29 ??

This, and also it doesn't actually seem to make use of the cropping support offered by e.g. ximagesink or xvimagesink.
Comment 1 Edward Hervey 2012-07-16 08:57:44 UTC
The problem is due to the way negotiation works with the base classes.

When you set the output format (which may include striding and whatsoever), the call to _set_caps and _negotiate doesn't happen before you call buffer_alloc or push()...

It looks like we might need to reinstate an explicit gst_video_decoder_negotiate() method for that.

It's also very likely this is the cause PAR isn't correct with some video feeds also.
Comment 2 Edward Hervey 2012-07-18 13:37:00 UTC
Created attachment 219123 [details] [review]
videodecoder: Expose _negotiate function

This is to be called by decoders once they have set the output format
in order for (re)negotiation to be triggered as early as possible.
Comment 3 Sebastian Dröge (slomo) 2012-07-18 13:39:12 UTC
Can't we let set_ouput_format() call this instead?
Comment 4 Edward Hervey 2012-07-18 13:42:26 UTC
(In reply to comment #3)
> Can't we let set_ouput_format() call this instead?

No, because you will be setting more details between set_output_format() and negotiate() (videoinfo settings, interlacing, etc....)
Comment 5 Sebastian Dröge (slomo) 2012-07-18 13:47:41 UTC
Oh yes, sorry, nevermind. Please get this in :) Also for the encoder please
Comment 6 Edward Hervey 2012-07-18 16:30:23 UTC
commit 8feaebb6ebb7bcafbe3d2b7cd46ee5f0a45bce0c
Author: Edward Hervey <edward.hervey@collabora.co.uk>
Date:   Wed Jul 18 15:34:06 2012 +0200

    videodecoder: Expose _negotiate function
    
    This is to be called by decoders once they have set the output format
    in order for (re)negotiation to be triggered as early as possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679878
Comment 7 Sebastian Dröge (slomo) 2012-07-19 07:18:39 UTC
Any opinions on doing the same with the video encoder base class?
Comment 8 Julien Isorce 2013-12-02 12:04:46 UTC
hi, I noticed that GstVideoDecoder::gst_video_decoder_negotiate does not clear the GST_PAD_FLAG_NEED_RECONFIGURE flag when it succeeds.

It causes to negociate again, so query allocation is done twice. (the second time in gst_video_decoder_allocate_output_frame).

Is it expected ? Is the subclass of GstVideoDecoder responsible for clearing the flag when manually calling gst_video_decoder_negotiate ?

It happens in the following pipeline:

gst-launch-1.0 v4l2src io-mode=mmap ! jpegdec ! xvimagesink

Since recently it seems that initially a pad is set to GST_PAD_FLAG_NEED_RECONFIGURE : 
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstpad.c#n1080

Since this commit:
http://cgit.freedesktop.org/gstreamer/gstreamer/commit/gst/gstpad.c?id=c279bdb663de532be58b31970b26ff515ff4f098

The negotiation design: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-negotiation.txt
Comment 9 Sebastian Dröge (slomo) 2013-12-02 12:14:22 UTC
That should probably be changed in the base class, it currently manually unsets the flag after calling negotiate() but AFAIU this could as well just be done inside negotiate() at the end.
Comment 10 Sebastian Dröge (slomo) 2013-12-02 12:14:37 UTC
Also this should get a new bug report