[longomatch] Handle device disconnections on windows



commit 675e9c17e6d245dbe4d6ce411d6209c94d9c8f4b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Aug 31 21:23:29 2010 +0200

    Handle device disconnections on windows
    
    Allow at least closing the current capture if the device
    was disconnected and the source is locking the streaming thread.

 libcesarplayer/src/gst-camera-capturer.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libcesarplayer/src/gst-camera-capturer.c b/libcesarplayer/src/gst-camera-capturer.c
index 691188b..d527a88 100644
--- a/libcesarplayer/src/gst-camera-capturer.c
+++ b/libcesarplayer/src/gst-camera-capturer.c
@@ -1202,6 +1202,13 @@ gst_camera_capturer_stop (GstCameraCapturer * gcc)
   g_return_if_fail (gcc != NULL);
   g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
 
+#ifdef WIN32
+  //On windows we can't handle device disconnections until dshowvideosrc
+  //supports it. When a device is disconnected, the source is locked
+  //in ::create(), blocking the streaming thread. We need to change its
+  //state to null, this way camerabin doesn't block in ::do_stop().
+  gst_element_set_state(gcc->priv->device_source, GST_STATE_NULL);
+#endif
   g_signal_emit_by_name (G_OBJECT (gcc->priv->camerabin), "capture-stop", 0, 0);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]