RESOLVED FIXED 29959
[GTK] QoS support in the video sink
https://bugs.webkit.org/show_bug.cgi?id=29959
Summary [GTK] QoS support in the video sink
Philippe Normand
Reported 2009-10-01 06:08:19 PDT
As slomo suggested, VideoSinkGStreamer.cpp should really implement QoS. If the idle callback is called too late it should simply drop the frame. ("too late" can be calculated from buffer timestamp, the sinks clock and the buffer duration or framerate).
Attachments
proposed patch (6.71 KB, patch)
2009-10-05 04:25 PDT, Philippe Normand
no flags
updated patch (9.98 KB, patch)
2009-10-05 10:39 PDT, Philippe Normand
gustavo: review-
updated patch (9.96 KB, patch)
2009-10-09 02:28 PDT, Philippe Normand
no flags
updated patch (11.11 KB, patch)
2009-10-09 03:43 PDT, Philippe Normand
no flags
Sebastian Dröge (slomo)
Comment 1 2009-10-01 06:17:36 PDT
Too late is (IIRC) element's base time + buffer time + buffer duration >= element's clock time
Philippe Normand
Comment 2 2009-10-05 04:25:55 PDT
Created attachment 40621 [details] proposed patch
Sebastian Dröge (slomo)
Comment 3 2009-10-05 04:28:59 PDT
Patch looks good to me but as said on IRC it's only a start, on top of this QoS as I've explained on IRC. This for now, will make playback go smoother and make sure that audio/video are displayed in sync.
Philippe Normand
Comment 4 2009-10-05 10:39:28 PDT
Created attachment 40640 [details] updated patch
Gustavo Noronha (kov)
Comment 5 2009-10-08 16:27:52 PDT
Comment on attachment 40640 [details] updated patch Awesome stuff, and I'm happy to see the real fix for the race condition happening! What do you think of moving this sink to WebKit/gtk/webkit/ like we did with soup-dialog, by the way? The synchronization and object life time handling look OK to me, I have just a couple nitpicks: > + // use HIGH_IDLE+20 priority, like Gtk+ for redrawing operations > + priv->timeout_id = g_timeout_add_full(G_PRIORITY_HIGH_IDLE + 20, 0, > + webkit_video_sink_timeout_func, > + gst_object_ref(sink), > + (GDestroyNotify) gst_object_unref); Additional space on the cast, and I suggest a normal sentence in the comment, with capital U and period =). > > static void > -webkit_video_sink_finalize(GObject* object) > +_unlock_buffer_mutex(WebKitVideoSinkPrivate* priv) > +{ > + > + g_mutex_lock(priv->buffer_mutex); > + There seems to be an unnecessary line at the start of this function. Also, I don't think we use this _name pattern anywhere else, so I'd suggest just dropping the underscore here. You are already declaring it static, which should be enough. Thanks for your work on this!
Philippe Normand
Comment 6 2009-10-09 02:28:06 PDT
Created attachment 40939 [details] updated patch
Sebastian Dröge (slomo)
Comment 7 2009-10-09 02:41:00 PDT
In the timeout callback, no need to get the timeout id. But set the timeout id to 0 in the callback after taking the mutex! When unblocking the buffer waiting, you also want to remove the timeout if the id is != 0.
Sebastian Dröge (slomo)
Comment 8 2009-10-09 02:49:21 PDT
Oh, and you want to make the video sink a subclass of GstVideoSink. This will actually set up the QoS/lateness logic in GstBaseSink, suitable for video: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideosink.html
Philippe Normand
Comment 9 2009-10-09 03:43:39 PDT
Created attachment 40940 [details] updated patch
Gustavo Noronha (kov)
Comment 10 2009-10-09 12:15:08 PDT
Comment on attachment 40940 [details] updated patch Thanks. And thanks to slomo for the meat of the review =).
WebKit Commit Bot
Comment 11 2009-10-09 12:37:48 PDT
Comment on attachment 40940 [details] updated patch Clearing flags on attachment: 40940 Committed r49401: <http://trac.webkit.org/changeset/49401>
WebKit Commit Bot
Comment 12 2009-10-09 12:37:52 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.