#define GST_RTP_SESSION_LOCK(sess) g_mutex_lock (&(sess)->priv->lock)
#define GST_RTP_SESSION_UNLOCK(sess) g_mutex_unlock (&(sess)->priv->lock)
+#define GST_RTP_SESSION_WAIT(sess) g_cond_wait (&(sess)->priv->cond, &(sess)->priv->lock)
+#define GST_RTP_SESSION_SIGNAL(sess) g_cond_signal (&(sess)->priv->cond)
+
struct _GstRtpSessionPrivate
{
GMutex lock;
+ GCond cond;
GstClock *sysclock;
RTPSession *session;
gboolean stop_thread;
GThread *thread;
gboolean thread_stopped;
+ gboolean wait_send;
/* caps mapping */
GHashTable *ptmap;
{
rtpsession->priv = GST_RTP_SESSION_GET_PRIVATE (rtpsession);
g_mutex_init (&rtpsession->priv->lock);
+ g_cond_init (&rtpsession->priv->cond);
rtpsession->priv->sysclock = gst_system_clock_obtain ();
rtpsession->priv->session = rtp_session_new ();
rtpsession->priv->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
g_hash_table_destroy (rtpsession->priv->ptmap);
g_mutex_clear (&rtpsession->priv->lock);
+ g_cond_clear (&rtpsession->priv->cond);
g_object_unref (rtpsession->priv->sysclock);
g_object_unref (rtpsession->priv->session);
GST_RTP_SESSION_LOCK (rtpsession);
+ while (rtpsession->priv->wait_send) {
+ GST_LOG_OBJECT (rtpsession, "waiting for RTP thread");
+ GST_RTP_SESSION_WAIT (rtpsession);
+ GST_LOG_OBJECT (rtpsession, "signaled...");
+ }
+
sysclock = rtpsession->priv->sysclock;
current_time = gst_clock_get_time (sysclock);
GST_RTP_SESSION_LOCK (rtpsession);
rtpsession->priv->stop_thread = TRUE;
+ rtpsession->priv->wait_send = FALSE;
+ GST_RTP_SESSION_SIGNAL (rtpsession);
if (rtpsession->priv->id)
gst_clock_id_unschedule (rtpsession->priv->id);
GST_RTP_SESSION_UNLOCK (rtpsession);
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
+ GST_RTP_SESSION_LOCK (rtpsession);
+ rtpsession->priv->wait_send = TRUE;
+ GST_RTP_SESSION_UNLOCK (rtpsession);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
GST_RTP_SESSION_LOCK (rtpsession);
if ((rtp_src = rtpsession->send_rtp_src))
gst_object_ref (rtp_src);
+ if (rtpsession->priv->wait_send) {
+ GST_LOG_OBJECT (rtpsession, "signal RTCP thread");
+ rtpsession->priv->wait_send = FALSE;
+ GST_RTP_SESSION_SIGNAL (rtpsession);
+ }
GST_RTP_SESSION_UNLOCK (rtpsession);
if (rtp_src) {