1 |
From eb21b6827e25b2c943025a662cde2049c0454a6b Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Fri, 15 Aug 2014 15:59:58 +0100 |
4 |
Subject: [PATCH] Related: rhbz#1130264 plausible fix for reported crash |
5 |
|
6 |
Change-Id: I4ccdf19bfc7986881f7022109f22f47a0f493591 |
7 |
--- |
8 |
avmedia/source/gstreamer/gstplayer.cxx | 20 ++++++++++++++++---- |
9 |
avmedia/source/gstreamer/gstplayer.hxx | 3 +++ |
10 |
2 files changed, 19 insertions(+), 4 deletions(-) |
11 |
|
12 |
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx |
13 |
index ceea8e2..836e89e 100644 |
14 |
--- a/avmedia/source/gstreamer/gstplayer.cxx |
15 |
+++ b/avmedia/source/gstreamer/gstplayer.cxx |
16 |
@@ -74,7 +74,9 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : |
17 |
mpXOverlay( NULL ), |
18 |
mnDuration( 0 ), |
19 |
mnWidth( 0 ), |
20 |
- mnHeight( 0 ) |
21 |
+ mnHeight( 0 ), |
22 |
+ mnWatchID( 0 ), |
23 |
+ mbWatchID( false ) |
24 |
{ |
25 |
// Initialize GStreamer library |
26 |
int argc = 1; |
27 |
@@ -127,11 +129,15 @@ void SAL_CALL Player::disposing() |
28 |
g_object_unref( G_OBJECT ( mpXOverlay ) ); |
29 |
mpXOverlay = NULL; |
30 |
} |
31 |
+ |
32 |
+ } |
33 |
+ if (mbWatchID) |
34 |
+ { |
35 |
+ g_source_remove(mnWatchID); |
36 |
+ mbWatchID = false; |
37 |
} |
38 |
} |
39 |
|
40 |
- |
41 |
- |
42 |
static gboolean pipeline_bus_callback( GstBus *, GstMessage *message, gpointer data ) |
43 |
{ |
44 |
Player* pPlayer = static_cast<Player*>(data); |
45 |
@@ -357,7 +363,13 @@ void Player::preparePlaybin( const OUString& rURL, GstElement *pSink ) |
46 |
g_object_set( G_OBJECT( mpPlaybin ), "uri", ascURL.getStr() , NULL ); |
47 |
|
48 |
pBus = gst_element_get_bus( mpPlaybin ); |
49 |
- gst_bus_add_watch( pBus, pipeline_bus_callback, this ); |
50 |
+ if (mbWatchID) |
51 |
+ { |
52 |
+ g_source_remove(mnWatchID); |
53 |
+ mbWatchID = false; |
54 |
+ } |
55 |
+ mnWatchID = gst_bus_add_watch( pBus, pipeline_bus_callback, this ); |
56 |
+ mbWatchID = true; |
57 |
DBG( "%p set sync handler", this ); |
58 |
#ifdef AVMEDIA_GST_0_10 |
59 |
gst_bus_set_sync_handler( pBus, pipeline_bus_sync_handler, this ); |
60 |
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx |
61 |
index 2426eed..33c9e4d 100644 |
62 |
--- a/avmedia/source/gstreamer/gstplayer.hxx |
63 |
+++ b/avmedia/source/gstreamer/gstplayer.hxx |
64 |
@@ -97,6 +97,9 @@ protected: |
65 |
int mnWidth; |
66 |
int mnHeight; |
67 |
|
68 |
+ guint mnWatchID; |
69 |
+ bool mbWatchID; |
70 |
+ |
71 |
osl::Condition maSizeCondition; |
72 |
}; |
73 |
|
74 |
-- |
75 |
1.9.3 |
76 |
|