Re : gstoggmux EOS handling issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re : gstoggmux EOS handling issue

Aurelien Grimaud (elzz)
Attached here are :

recordtwice.2.py : slightly different from the initial one you provide. It blocks tee src pad, send eos and release tee request pad.
It also has a timeoverlay on video.
With patch http://bugzilla.gnome.org/show_bug.cgi?id=474016 (relaying newsegment for new tee src pad), it works fine.

The only problem is that first buffer timestamp is running timestamp.
totem just play the to recorded files fine.
mplayer also, though when printing elapsed time, it start with running timestamp recorded, not 0
xine plays it ok too, but waits for initial timestamp (3secs, 10 secs) with frozen video before playing.

gst-launch -v filesrc location=output1.ogg ! decodebin ! fakesink sync=TRUE
Définition du pipeline à PAUSED...
/pipeline0/decodebin0/typefind.src: caps = application/ogg
Le pipeline est en phase de PREROLL...
/pipeline0/decodebin0/queue0.sink: caps = video/x-theora
/pipeline0/decodebin0/queue0.src: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.sink: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1.sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0.proxypad1: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1: last-message = "preroll   ******* "
Le pipeline a terminé la phase PREROLL...
Passage du pipeline à la phase PLAYING...
/pipeline0/fakesink1: last-message = "event   ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied_rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0, stop=(gint64)9000000000, position=(gint64)0;) 0x86edd18"
/pipeline0/fakesink1: last-message = "event   ******* E (type: 118, taglist, encoder=(string)\"Xiph.Org\\ libTheora\\ I\\ 20070915\\ 3\\ 2\\ 1\", encoder-version=(guint)3, video-codec=(string)Theora;) 0x8861f40"
New clock: GstSystemClock
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:00.000000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 32) 0x87eec50"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.000000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 32) 0x87eecf0"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.100000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 0) 0x87eeca0"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.200000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 0) 0x87eeaa0"

When you get rid of timeoverlay, behavior changes.
The first buffer timestamp is now 0, but the second one is the timestamp of record start.
This makes :
totem, mplayer and xine waits for second timestamp with frozen video.

gst-launch -v filesrc location=output1.ogg ! decodebin ! fakesink sync=TRUE
Définition du pipeline à PAUSED...
/pipeline0/decodebin0/typefind.src: caps = application/ogg
Le pipeline est en phase de PREROLL...
/pipeline0/decodebin0/queue0.sink: caps = video/x-theora
/pipeline0/decodebin0/queue0.src: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.sink: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1.sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0.proxypad1: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)10/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1: last-message = "preroll   ******* "
Le pipeline a terminé la phase PREROLL...
Passage du pipeline à la phase PLAYING...
/pipeline0/fakesink1: last-message = "event   ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied_rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)3900000000, stop=(gint64)8900000000, position=(gint64)0;) 0x9965d18"
/pipeline0/fakesink1: last-message = "event   ******* E (type: 118, taglist, encoder=(string)\"Xiph.Org\\ libTheora\\ I\\ 20070915\\ 3\\ 2\\ 1\", encoder-version=(guint)3, video-codec=(string)Theora;) 0x9ad9f40"
New clock: GstSystemClock
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:03.900000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 32) 0x9a66b90"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.000000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 0) 0x9a66c00"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.100000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1, flags: 0) 0x9a66c50"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.200000000, duration: 0:00:00.100000000, offset: -1, offset_end: -1

gst-record.cc is recordtwice.2.py written in C++, without pad block or clockoverlay.
It works the same as py with clockoverlay (fine but first timestamp is not 0)

gst-launch -v filesrc location=output1.ogg ! decodebin ! fakesink sync=TRUE
Définition du pipeline à PAUSED...
/pipeline0/decodebin0/typefind.src: caps = application/ogg
Le pipeline est en phase de PREROLL...
/pipeline0/decodebin0/queue0.sink: caps = video/x-theora
/pipeline0/decodebin0/queue0.src: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.sink: caps = video/x-theora
/pipeline0/decodebin0/theoradec1.src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1.sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/decodebin0.src0.proxypad1: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240
/pipeline0/fakesink1: last-message = "preroll   ******* "
Le pipeline a terminé la phase PREROLL...
Passage du pipeline à la phase PLAYING...
/pipeline0/fakesink1: last-message = "event   ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied_rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)3933333333, stop=(gint64)8933333333, position=(gint64)0;) 0x8ad7d40"
/pipeline0/fakesink1: last-message = "event   ******* E (type: 118, taglist, encoder=(string)\"Xiph.Org\\ libTheora\\ I\\ 20070915\\ 3\\ 2\\ 1\", encoder-version=(guint)3, video-codec=(string)Theora;) 0x8ad7d68"
New clock: GstSystemClock
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:03.933333333, duration: 0:00:00.033333333, offset: -1, offset_end: -1, flags: 32) 0x8a64c50"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:03.966666666, duration: 0:00:00.033333334, offset: -1, offset_end: -1, flags: 0) 0x8a64cf0"
/pipeline0/fakesink1: last-message = "chain   ******* < (115200 bytes, timestamp: 0:00:04.000000000, duration: 0:00:00.033333333, offset: -1, offset_end: -1, flags: 0) 0x8a64ca0"


Why the initial timestamp  difference with timeoverlay ?
What is in python binding which makes its behavior change from C ?
Something with freeing gstreamer elements (such as ghost pads or request pads) ?
I noticed you have to be extra careful with request pads when working with dynamic pipeline.
You have to release them when you do not use them anymore.

Aurelien

----- Message d'origine ----
De : Daniel Drake <[hidden email]>
À : Tim-Philipp Müller <[hidden email]>
Cc : [hidden email]
Envoyé le : Lundi, 11 Août 2008, 17h27mn 08s
Objet : Re: [gst-devel] gstoggmux EOS handling issue

On Fri, 2008-08-08 at 14:11 +0100, Tim-Philipp Müller wrote:
> (Btw, not sure what exactly you were trying to fix, and I only had a
> very quick look at your code, but at first glance the shutdown sequence
> doesn't seem ideal: as far as I can see it won't shut down cleanly with
> an EOS making it through the recording bin; for ogg this just means that
> in the worst case you're losing a few frames at the end; with other
> muxers you might get slightly broken and/or indexless files).

Tim explained this on IRC. Cleanly shutting down the recording stream
works around the bug I found (if it is indeed a bug).

In case it helps others, the process for cleanly stopping a live capture
is as follows:
- send an EOS on the live capture element(s) using
  gst_element_send_event(gst_event_new_eos())
- connect a watch handler to the bus of the pipeline and wait for
  GST_MESSAGE_EOS
- when EOS arrives, set the pipeline state to NULL

Working code here:
http://dev.laptop.org/~dsd/20080811/recordtwice.txt

Daniel



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

gst-record-twice.cc (5K) Download Attachment
recordtwice.2.py (8K) Download Attachment