summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-08-28 20:07:48 +0200
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-09-02 18:21:11 +0200
commitef7a8c2ca86590d994f6cf768070d75b05dd7b61 (patch)
tree929dd657b987a9cfec8cf12cca7d0dbd4af09cce
parent994739332d229a96fdc6bee9932d72349c29c614 (diff)
downloadgstreamer-plugins-bad-ef7a8c2ca86590d994f6cf768070d75b05dd7b61.tar.gz
d3dvideosink: disable buffer pools
On a device lost, all the surfaces allocated in the device need to be released before resetting the device, which can't be done for the allocated buffers. https://bugzilla.gnome.org/show_bug.cgi?id=706566
-rw-r--r--sys/d3dvideosink/Makefile.am3
-rw-r--r--sys/d3dvideosink/d3dhelpers.c6
-rw-r--r--sys/d3dvideosink/d3dvideosink.c3
3 files changed, 11 insertions, 1 deletions
diff --git a/sys/d3dvideosink/Makefile.am b/sys/d3dvideosink/Makefile.am
index b30c4dad1..986a00682 100644
--- a/sys/d3dvideosink/Makefile.am
+++ b/sys/d3dvideosink/Makefile.am
@@ -1,7 +1,8 @@
plugin_LTLIBRARIES = libgstd3dvideosink.la
libgstd3dvideosink_la_SOURCES = d3dvideosink.c d3dhelpers.c
-libgstd3dvideosink_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(DIRECT3D_CFLAGS) $(DIRECTX_CFLAGS)
+libgstd3dvideosink_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(DIRECT3D_CFLAGS) $(DIRECTX_CFLAGS) \
+ -DDISABLE_BUFFER_POOL
libgstd3dvideosink_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
$(DIRECT3D_LIBS) $(DIRECTX_LDFAGS)
diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c
index 672bbebee..e405b1c45 100644
--- a/sys/d3dvideosink/d3dhelpers.c
+++ b/sys/d3dvideosink/d3dhelpers.c
@@ -1866,9 +1866,13 @@ d3d_render_buffer (GstD3DVideoSink * sink, GstBuffer * buf)
surface = ((GstD3DSurfaceMemory *) mem)->surface;
+#ifndef DISABLE_BUFFER_POOL
/* Need to keep an additional ref until the next buffer
* to make sure it isn't reused until then */
sink->fallback_buffer = buf;
+#else
+ sink->fallback_buffer = NULL;
+#endif
} else {
mem = gst_buffer_peek_memory (buf, 0);
surface = ((GstD3DSurfaceMemory *) mem)->surface;
@@ -1881,7 +1885,9 @@ d3d_render_buffer (GstD3DVideoSink * sink, GstBuffer * buf)
if (sink->d3d.surface)
IDirect3DSurface9_Release (sink->d3d.surface);
+#ifndef DISABLE_BUFFER_POOL
IDirect3DSurface9_AddRef (surface);
+#endif
sink->d3d.surface = surface;
if (!d3d_present_swap_chain (sink)) {
diff --git a/sys/d3dvideosink/d3dvideosink.c b/sys/d3dvideosink/d3dvideosink.c
index 2b5086e0c..09ced0857 100644
--- a/sys/d3dvideosink/d3dvideosink.c
+++ b/sys/d3dvideosink/d3dvideosink.c
@@ -172,6 +172,7 @@ gst_d3dvideosink_init (GstD3DVideoSink * sink)
sink->create_internal_window = DEFAULT_CREATE_RENDER_WINDOW;
sink->stream_stop_on_close = DEFAULT_STREAM_STOP_ON_CLOSE;
sink->enable_navigation_events = DEFAULT_ENABLE_NAVIGATION_EVENTS;
+ sink->d3d.surface = NULL;
g_rec_mutex_init (&sink->lock);
}
@@ -519,7 +520,9 @@ gst_d3dvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
if (pool) {
/* we need at least 2 buffer because we hold on to the last one */
+#ifndef DISABLE_BUFFER_POOL
gst_query_add_allocation_pool (query, pool, size, 2, 0);
+#endif
gst_object_unref (pool);
}