summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2014-09-10 23:18:15 -0700
committerDavid Schleef <ds@schleef.org>2014-09-10 23:18:30 -0700
commit0cc9215bb29ffa5e31d0d3c19742624ac5ca43e3 (patch)
treefb6ee53478572fcb1c2ac02f886b7bbd6819e1dc
parent2526e2ed95129e1666e280276f7aa07e9e07ca78 (diff)
connection: add thread warnings
-rw-r--r--rtmp/rtmpconnection.c16
-rw-r--r--rtmp/rtmpconnection.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/rtmp/rtmpconnection.c b/rtmp/rtmpconnection.c
index f865fa4..f0b76db 100644
--- a/rtmp/rtmpconnection.c
+++ b/rtmp/rtmpconnection.c
@@ -228,6 +228,7 @@ gst_rtmp_connection_set_socket_connection (GstRtmpConnection * sc,
{
GInputStream *is;
+ sc->thread = g_thread_self();
sc->connection = connection;
/* refs the socket because it's creating an input stream, which holds a ref */
@@ -244,6 +245,9 @@ gst_rtmp_connection_set_socket_connection (GstRtmpConnection * sc,
void
gst_rtmp_connection_close (GstRtmpConnection * connection)
{
+ if (connection->thread != g_thread_self()) {
+ GST_ERROR("Called from wrong thread");
+ }
g_cancellable_cancel (connection->cancellable);
@@ -769,6 +773,9 @@ gst_rtmp_connection_queue_chunk (GstRtmpConnection * connection,
g_return_if_fail (GST_IS_RTMP_CONNECTION (connection));
g_return_if_fail (GST_IS_RTMP_CHUNK (chunk));
+ if (connection->thread != g_thread_self()) {
+ GST_ERROR("Called from wrong thread");
+ }
g_queue_push_tail (connection->output_queue, chunk);
gst_rtmp_connection_start_output (connection);
}
@@ -803,6 +810,9 @@ void
gst_rtmp_connection_start_handshake (GstRtmpConnection * connection,
gboolean is_server)
{
+ if (connection->thread != g_thread_self()) {
+ GST_ERROR("Called from wrong thread");
+ }
if (is_server) {
gst_rtmp_connection_set_input_callback (connection,
gst_rtmp_connection_server_handshake1, 1537);
@@ -957,6 +967,9 @@ gst_rtmp_connection_send_command (GstRtmpConnection * connection,
{
GstRtmpChunk *chunk;
+ if (connection->thread != g_thread_self()) {
+ GST_ERROR("Called from wrong thread");
+ }
chunk = gst_rtmp_chunk_new ();
chunk->chunk_stream_id = chunk_stream_id;
chunk->timestamp = 0; /* FIXME */
@@ -994,6 +1007,9 @@ gst_rtmp_connection_send_command2 (GstRtmpConnection * connection,
{
GstRtmpChunk *chunk;
+ if (connection->thread != g_thread_self()) {
+ GST_ERROR("Called from wrong thread");
+ }
chunk = gst_rtmp_chunk_new ();
chunk->chunk_stream_id = chunk_stream_id;
chunk->timestamp = 0; /* FIXME */
diff --git a/rtmp/rtmpconnection.h b/rtmp/rtmpconnection.h
index 48287f4..c84cead 100644
--- a/rtmp/rtmpconnection.h
+++ b/rtmp/rtmpconnection.h
@@ -49,6 +49,7 @@ struct _GstRtmpConnection
gboolean closed;
/* private */
+ GThread *thread;
GSocketConnection *connection;
GCancellable *cancellable;
int state;