[farsight2/master] Make sure the pipeline is playing before we start trying to do dtmf

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:26:41 PST 2008


---
 tests/check/rtp/sendcodecs.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/tests/check/rtp/sendcodecs.c b/tests/check/rtp/sendcodecs.c
index 7dc6dd5..82c3769 100644
--- a/tests/check/rtp/sendcodecs.c
+++ b/tests/check/rtp/sendcodecs.c
@@ -37,6 +37,7 @@ guint dtmf_id = 0;
 gint digit = 0;
 gboolean sending = FALSE;
 gboolean received = FALSE;
+gboolean ready_to_send = FALSE;
 
 struct SimpleTestConference *dat = NULL;
 
@@ -108,6 +109,11 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
               error, debug);
           g_type_class_unref (enumclass);
         }
+        else if (gst_structure_has_name (s, "farsight-send-codec-changed"))
+        {
+          ready_to_send = TRUE;
+        }
+
       }
       break;
     case GST_MESSAGE_ERROR:
@@ -317,10 +323,22 @@ send_dmtf_havedata_handler (GstPad *pad, GstBuffer *buf, gpointer user_data)
 static gboolean
 start_stop_sending_dtmf (gpointer data)
 {
+  GstState state;
+  GstStateChangeReturn ret;
 
-  if (!dat || !dat->session)
+  if (!dat || !dat->pipeline || !dat->session)
     return TRUE;
 
+  ret = gst_element_get_state (dat->pipeline, &state, NULL, 0);
+  ts_fail_if (ret == GST_STATE_CHANGE_FAILURE);
+
+  if (state != GST_STATE_PLAYING)
+    return TRUE;
+
+  if(!ready_to_send)
+    return TRUE;
+
+
   if (sending)
   {
     ts_fail_unless (fs_session_stop_telephony_event (dat->session, method),
-- 
1.5.6.5




More information about the farsight-commits mailing list