diff options
Diffstat (limited to 'sys/dshowvideosink')
-rw-r--r-- | sys/dshowvideosink/dshowvideosink.cpp | 11 | ||||
-rw-r--r-- | sys/dshowvideosink/dshowvideosink.h | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sys/dshowvideosink/dshowvideosink.cpp b/sys/dshowvideosink/dshowvideosink.cpp index b191c98b..788dbdd5 100644 --- a/sys/dshowvideosink/dshowvideosink.cpp +++ b/sys/dshowvideosink/dshowvideosink.cpp @@ -211,9 +211,13 @@ gst_dshowvideosink_clear (GstDshowVideoSink *sink) static void
gst_dshowvideosink_init (GstDshowVideoSink * sink, GstDshowVideoSinkClass * klass)
{
+ HRESULT hr;
+
gst_dshowvideosink_clear (sink);
- CoInitializeEx (NULL, COINIT_MULTITHREADED);
+ hr = CoInitialize (0);
+ if (SUCCEEDED(hr))
+ sink->comInitialized = TRUE;
/* TODO: Copied from GstVideoSink; should we use that as base class? */
/* 20ms is more than enough, 80-130ms is noticable */
@@ -229,7 +233,10 @@ gst_dshowvideosink_finalize (GObject * gobject) if (sink->preferredrenderer)
g_free (sink->preferredrenderer);
- CoUninitialize ();
+ if (sink->comInitialized) {
+ CoUninitialize ();
+ sink->comInitialized = FALSE;
+ }
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
diff --git a/sys/dshowvideosink/dshowvideosink.h b/sys/dshowvideosink/dshowvideosink.h index 69ac28e2..fd03c2b7 100644 --- a/sys/dshowvideosink/dshowvideosink.h +++ b/sys/dshowvideosink/dshowvideosink.h @@ -91,6 +91,8 @@ struct _GstDshowVideoSink /* If we use an app-supplied window, we need to hook its WNDPROC */ WNDPROC prevWndProc; + + gboolean comInitialized; }; struct _GstDshowVideoSinkClass |