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 579926 - [directshowvideosink] Doesn't update the last frame after a seek with the pipeline in PAUSED state.
[directshowvideosink] Doesn't update the last frame after a seek with the pip...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal normal
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-23 08:38 UTC by Andoni Morales
Modified: 2010-08-14 13:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-dshowvideosink-Use-the-GstVideoSink-base-class (1.79 KB, patch)
2010-02-14 18:43 UTC, Andoni Morales
none Details | Review
0002-dshowvideosink-Prepare-the-implementation-of-preroll (1.91 KB, patch)
2010-02-14 18:44 UTC, Andoni Morales
none Details | Review
0003-dshowvideosink-Implement-preroll-virtual-method (2.81 KB, patch)
2010-02-14 18:45 UTC, Andoni Morales
none Details | Review
0003-dshowvideosink-Implement-preroll-virtual-method (4.83 KB, patch)
2010-02-14 19:35 UTC, Andoni Morales
reviewed Details | Review
0002-dshowvideosink-Implement-show_frame-virtual-method.patch (4.86 KB, patch)
2010-02-14 20:20 UTC, Andoni Morales
none Details | Review
0003-dshowvideosink-Prepare-window-and-link-graph-on-set_caps() (2.42 KB, patch)
2010-02-15 19:39 UTC, Andoni Morales
none Details | Review
0004-dshowvideosink-Implement-XOverlay-expose.patch (1.74 KB, patch)
2010-02-15 19:40 UTC, Andoni Morales
none Details | Review
0003-dshowvideosink-Prepare-window-and-link-graph-on-set_caps() (2.42 KB, patch)
2010-02-15 19:43 UTC, Andoni Morales
none Details | Review

Description Andoni Morales 2009-04-23 08:38:03 UTC
On linux, using any of the availables videosink and with the pipeline in PAUSED state, when I  send a seek event, for example to the next frame, the new frame is drawn by the video sink.

Instead on Windows, using the directshowvideosink, I need to set the pipeline into PLAYING state before sending the seek event and then reset the pipeline to PAUSED state to get the next frame drawn, which doesn't always work  as
some times the seek is done before returning to the paused state.

I guess I could be a bug on the directshowvideosink.

Looking at the code, the Direct Show graph is paused when the pipeline goes into PAUSED state, and it's set into playing state only when the pipeline returns into playing state, and that should be why it doesn't draw the new frame when the pipeline is paused. We should be able to update the graph when a new frame comes into the video sink.
Comment 1 David Hoyt 2010-02-11 22:11:59 UTC
Has this been fixed?
Comment 2 Andoni Morales 2010-02-14 18:43:59 UTC
Created attachment 153776 [details] [review]
0001-dshowvideosink-Use-the-GstVideoSink-base-class
Comment 3 Andoni Morales 2010-02-14 18:44:33 UTC
Created attachment 153777 [details] [review]
0002-dshowvideosink-Prepare-the-implementation-of-preroll
Comment 4 Andoni Morales 2010-02-14 18:45:23 UTC
Created attachment 153778 [details] [review]
0003-dshowvideosink-Implement-preroll-virtual-method
Comment 5 Andoni Morales 2010-02-14 18:55:24 UTC
The previous patches implements the preroll() virtual method and fixes the bug.

There is still an issue I haven't been able to fix, which is rendering the first preroll buffer.
The current implementation prepare the window and connect the graph in a PAUSED_TO_READY state change, whilst it should be done in set_caps(), this way the window will ready and the graph connected when the first preroll buffer is received.
I have tried to call gst_dshowvideosink_prepare_window() in set_caps() function, which calls gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sink)). The problem is that in the application side GST_X_OVERLAY(sink) is NULL.
I don't understand why calling this funtion in the PAUSED_TO_PLAY state works but it doesn't in the READY_TO_PAUSED :/
Comment 6 Tim-Philipp Müller 2010-02-14 18:58:03 UTC
If you move the code over to GstVideoSink, it would be best if you only implemented the ::show_frame() vfunc instead of preroll/render, so that the "show-preroll-frame" property works.
Comment 7 Andoni Morales 2010-02-14 19:35:23 UTC
Created attachment 153788 [details] [review]
0003-dshowvideosink-Implement-preroll-virtual-method

I fixed a mistake in the previous patch and used show_frame().
Comment 8 Tim-Philipp Müller 2010-02-14 19:50:07 UTC
Review of attachment 153788 [details] [review]:

::: sys/dshowvideosink/dshowvideosink.cpp
@@ +178,3 @@
       GST_DEBUG_FUNCPTR (gst_dshowvideosink_unlock_stop);
+  gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_dshowvideosink_show_frame);
+  gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_dshowvideosink_show_frame);

I think this should be

gstvideosink_class->show_frame = GST_DEBUG_FUNCPTR(gst_dshowvideosink_show_frame);
Comment 9 Andoni Morales 2010-02-14 20:20:49 UTC
Created attachment 153796 [details] [review]
0002-dshowvideosink-Implement-show_frame-virtual-method.patch

Thanks for the review :)
I used ::show_frame() from GstVideoSink instead of ::preroll() and ::render(), and deleted the second commit since it doesn't make to much sense.
Comment 10 Andoni Morales 2010-02-14 21:00:15 UTC
I also want to implement the ::expose() function. Should I use gst_base_sink_get_last_buffer() or rather use a reference of the last rendered buffer? (I'm not sure if both are equivalent)
Comment 11 Andoni Morales 2010-02-14 23:57:52 UTC
Regarding the issues in Comment 5, it was related to a bug in my application. I'll attach the patch tomorrow.
Comment 12 Andoni Morales 2010-02-15 19:39:22 UTC
Created attachment 153858 [details] [review]
0003-dshowvideosink-Prepare-window-and-link-graph-on-set_caps()

Prepare the window and connect the graph on set_caps(), this way everything is ready to render the first preroll buffer.
Comment 13 Andoni Morales 2010-02-15 19:40:11 UTC
Created attachment 153859 [details] [review]
0004-dshowvideosink-Implement-XOverlay-expose.patch

Implement XOverlay expose() function
Comment 14 Andoni Morales 2010-02-15 19:43:58 UTC
Created attachment 153860 [details] [review]
0003-dshowvideosink-Prepare-window-and-link-graph-on-set_caps()

Fixed typo in previous patch
Comment 15 Tim-Philipp Müller 2010-02-16 23:51:07 UTC
Based on comments on IRC I think we should hold off on these changes and put htem in after the release so they have more chance to get a bit of testing before being released.

Some context (poorly transcribed): "it's plausible that patch set wouldn't make things any worse, though my attempts to implement preroll properly in there were very much more invasive to make it reliable, so I'd be a bit worried that it doesn't handle any of the edge cases. The biggest problem with it is that it uses COM, and the COM initialisation semantics work really poorly with GStreamer: you're supposed to init COM on any thread that uses COM, but you must uninit COM on the same thread - and GStreamer doesn't really give you any way to do that. So it's flaky."
Comment 16 Andoni Morales 2010-03-17 09:51:02 UTC
That sounds good.
I will include the patched version in the next WinBuilds release to get as much feedback as possible.