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 722697 - pad: Setting pad offsets breaks the running time in QoS and other events
pad: Setting pad offsets breaks the running time in QoS and other events
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.2.2
Other Linux
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-21 14:30 UTC by [laucha]
Modified: 2014-04-10 06:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
example's app showing the bug (3.67 KB, text/x-csrc)
2014-01-21 14:30 UTC, [laucha]
Details

Description [laucha] 2014-01-21 14:30:32 UTC
Created attachment 266874 [details]
example's app showing the bug

If we have a pipe like this:
    videotestsrc ! video/x-raw, width=<w>, height=<h> ! videomixer ! xvimagesink

Then on PLAYING_STATE:

1. Wait for a arbitrary period of time.
2. Set the pipe on PAUSED_STATE.
3. Request a new pad on the mixer.
4. Call gst_pad_set_offset(<current_running_time) on the new mixer's pad.
5. Create a bin (filesrc ! matroskademux ! theoradec).
6. Link the bin and the new mixer's sink pad.  
7. Call gst_element_sync_state_with_parent on the bin
8. Set the pipeline on PLAYING_STATE.

The result is that the new video is showed during a short time. 
The decoder shows "dropping frame because of QoS".

The video referenced in the example's code was generated with:
 gst-launch-1.0 -e videotestsrc ! timeoverlay font-desc=60 ! video/x-raw, width=250,height=250 ! theoraenc ! matroskamux ! filesink location=video.mkv


Notes:
   * If we use videotestsrc instead of filesrc on step 5, the pipe works OK.
   * Using fakesink or filesink instead of xvimagesink works OK.
   * If we drop the QOS on the decoder's src pad the video is showed correctly.
Comment 1 [laucha] 2014-01-21 14:44:38 UTC
On http://www.filedropper.com/logtar I've uploaded a tar.bz with the output log of running with GST_DEBUG=6.

The first WARN message of the theoradec is:
0:00:05.294375461 28228      0x1228e30 WARN               theoradec gsttheoradec.c:741:theora_handle_data_packet:<theoradec0> dropping frame because of QoS.
Comment 2 Sebastian Dröge (slomo) 2014-01-22 09:50:21 UTC
Ah yes, the QoS events need to be adapted for the pad offsets :)
Comment 3 Sebastian Dröge (slomo) 2014-01-22 15:54:50 UTC
Wim suggested to add an offset field to GstEvent, and consumers of events can do something with that then. Not ideal yet.
Comment 4 Sebastian Dröge (slomo) 2014-04-07 06:50:02 UTC
This should fix it, but it's untested so far:

http://cgit.freedesktop.org/~slomo/gstreamer/log/?h=event-offsets
Comment 5 Sebastian Dröge (slomo) 2014-04-08 11:31:19 UTC
Fixes your sample application btw
Comment 6 Wim Taymans 2014-04-09 16:50:43 UTC
it looks good to me.
Comment 7 Sebastian Dröge (slomo) 2014-04-10 06:27:13 UTC
commit 1492465b89961622947c2c41a454c5e7f61b6b61
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Fri Apr 4 17:28:23 2014 +0200

    event: Update running time in QoS based on the pad offsets
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722697

commit 42cbb7c7c70126b781cf730977fa85986d5a95ed
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Fri Apr 4 17:15:25 2014 +0200

    pad: Apply pad offsets on all events, not just segment events

commit d445027ec17954820c60379b5aadd16274ad683f
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Fri Apr 4 17:06:18 2014 +0200

    event: Add running-time-offset field to all events
    
    Events passing through #GstPads that have a running time
    offset set via gst_pad_set_offset() will get their offset
    adjusted according to the pad's offset.
    
    If the event contains any information that related to the
    running time, this information will need to be updated
    before usage with this offset.