summaryrefslogtreecommitdiffstats
path: root/sys/dshowvideosink/dshowvideosink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dshowvideosink/dshowvideosink.cpp')
-rw-r--r--sys/dshowvideosink/dshowvideosink.cpp11
1 files changed, 9 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);
}