rtsp thread pool

A GstRTSPThreadPool manages reusable threads for various server tasks. Currently the defined thread types can be found in GstRTSPThreadType.

Threads of type GST_RTSP_THREAD_TYPE_CLIENT are used to handle requests from a connected client. With gst_rtsp_thread_pool_get_max_threads a maximum number of threads can be set after which the pool will start to reuse the same thread for multiple clients.

Threads of type GST_RTSP_THREAD_TYPE_MEDIA will be used to perform the state changes of the media pipelines and handle its bus messages.

gst_rtsp_thread_pool_get_thread can be used to create a GstRTSPThread object of the right type. The thread object contains a mainloop and context that run in a seperate thread and can be used to attached sources to.

gst_rtsp_thread_reuse can be used to reuse a thread for multiple purposes. If all gst_rtsp_thread_reuse calls are matched with a gst_rtsp_thread_stop call, the mainloop will be quit and the thread will stop.

To configure the threads, a subclass of this object should be made and the virtual methods should be overriden to implement the desired functionality.

Last reviewed on 2013-07-11 (1.0.0)

GstRTSPThread

Structure holding info about a mainloop running in a thread

Members

mini_object (GstMiniObject) –

parent GstMiniObject

type (GstRTSPThreadType) –

the thread type

context (GMainContext *) –

a GMainContext

loop (GMainLoop *) –

a GMainLoop


GstRtspServer.RTSPThread

Structure holding info about a mainloop running in a thread

Members

mini_object (Gst.MiniObject) –

parent Gst.MiniObject

the thread type


GstRtspServer.RTSPThread

Structure holding info about a mainloop running in a thread

Members

mini_object (Gst.MiniObject) –

parent Gst.MiniObject

the thread type


Constructors

gst_rtsp_thread_new

GstRTSPThread *
gst_rtsp_thread_new (GstRTSPThreadType type)

Create a new thread object that can run a mainloop.

Parameters:

type

the thread type

Returns ( [transfer: full])

a GstRTSPThread.


GstRtspServer.RTSPThread.prototype.new

function GstRtspServer.RTSPThread.prototype.new(type: GstRtspServer.RTSPThreadType): {
    // javascript wrapper for 'gst_rtsp_thread_new'
}

Create a new thread object that can run a mainloop.

Parameters:

the thread type


GstRtspServer.RTSPThread.new

def GstRtspServer.RTSPThread.new (type):
    #python wrapper for 'gst_rtsp_thread_new'

Create a new thread object that can run a mainloop.

Parameters:

the thread type


Methods

gst_rtsp_thread_reuse

gboolean
gst_rtsp_thread_reuse (GstRTSPThread * thread)

Reuse the mainloop of thread

Parameters:

thread ( [transfer: none])

a GstRTSPThread

Returns

TRUE if the mainloop could be reused


GstRtspServer.RTSPThread.prototype.reuse

function GstRtspServer.RTSPThread.prototype.reuse(): {
    // javascript wrapper for 'gst_rtsp_thread_reuse'
}

Reuse the mainloop of thread

Returns (Number)

true if the mainloop could be reused


GstRtspServer.RTSPThread.reuse

def GstRtspServer.RTSPThread.reuse (self):
    #python wrapper for 'gst_rtsp_thread_reuse'

Reuse the mainloop of thread

Returns (bool)

True if the mainloop could be reused


gst_rtsp_thread_stop

gst_rtsp_thread_stop (GstRTSPThread * thread)

Stop and unref thread. When no threads are using the mainloop, the thread will be stopped and the final ref to thread will be released.

Parameters:

thread ( [transfer: full])

a GstRTSPThread


GstRtspServer.RTSPThread.prototype.stop

function GstRtspServer.RTSPThread.prototype.stop(): {
    // javascript wrapper for 'gst_rtsp_thread_stop'
}

Stop and unref thread. When no threads are using the mainloop, the thread will be stopped and the final ref to thread will be released.


GstRtspServer.RTSPThread.stop

def GstRtspServer.RTSPThread.stop (self):
    #python wrapper for 'gst_rtsp_thread_stop'

Stop and unref thread. When no threads are using the mainloop, the thread will be stopped and the final ref to thread will be released.


GstRTSPThreadPool

GObject
    ╰──GstRTSPThreadPool

The thread pool structure.

Members

parent (GObject) –
No description available

Class structure

GstRTSPThreadPoolClass

Class for managing threads.

Fields
parent_class (GObjectClass) –
No description available
pool (GThreadPool *) –

a GThreadPool used internally


GstRtspServer.RTSPThreadPoolClass

Class for managing threads.

Attributes
parent_class (GObject.ObjectClass) –
No description available
pool (GLib.ThreadPool) –

a GLib.ThreadPool used internally


GstRtspServer.RTSPThreadPoolClass

Class for managing threads.

Attributes
parent_class (GObject.ObjectClass) –
No description available
pool (GLib.ThreadPool) –

a GLib.ThreadPool used internally


GstRtspServer.RTSPThreadPool

GObject.Object
    ╰──GstRtspServer.RTSPThreadPool

The thread pool structure.

Members

parent (GObject.Object) –
No description available

GstRtspServer.RTSPThreadPool

GObject.Object
    ╰──GstRtspServer.RTSPThreadPool

The thread pool structure.

Members

parent (GObject.Object) –
No description available

Constructors

gst_rtsp_thread_pool_new

GstRTSPThreadPool *
gst_rtsp_thread_pool_new ()

Create a new GstRTSPThreadPool instance.

Returns ( [transfer: full])

a new GstRTSPThreadPool


GstRtspServer.RTSPThreadPool.prototype.new

function GstRtspServer.RTSPThreadPool.prototype.new(): {
    // javascript wrapper for 'gst_rtsp_thread_pool_new'
}

Create a new GstRtspServer.RTSPThreadPool instance.


GstRtspServer.RTSPThreadPool.new

def GstRtspServer.RTSPThreadPool.new ():
    #python wrapper for 'gst_rtsp_thread_pool_new'

Create a new GstRtspServer.RTSPThreadPool instance.


Methods

gst_rtsp_thread_pool_get_max_threads

gint
gst_rtsp_thread_pool_get_max_threads (GstRTSPThreadPool * pool)

Get the maximum number of threads used for client connections. See gst_rtsp_thread_pool_set_max_threads.

Parameters:

pool

a GstRTSPThreadPool

Returns

the maximum number of threads.


GstRtspServer.RTSPThreadPool.prototype.get_max_threads

function GstRtspServer.RTSPThreadPool.prototype.get_max_threads(): {
    // javascript wrapper for 'gst_rtsp_thread_pool_get_max_threads'
}

Get the maximum number of threads used for client connections. See GstRtspServer.RTSPThreadPool.prototype.set_max_threads.

Returns (Number)

the maximum number of threads.


GstRtspServer.RTSPThreadPool.get_max_threads

def GstRtspServer.RTSPThreadPool.get_max_threads (self):
    #python wrapper for 'gst_rtsp_thread_pool_get_max_threads'

Get the maximum number of threads used for client connections. See GstRtspServer.RTSPThreadPool.set_max_threads.

Returns (int)

the maximum number of threads.


gst_rtsp_thread_pool_get_thread

GstRTSPThread *
gst_rtsp_thread_pool_get_thread (GstRTSPThreadPool * pool,
                                 GstRTSPThreadType type,
                                 GstRTSPContext * ctx)

Get a new GstRTSPThread for type and ctx.

Parameters:

pool

a GstRTSPThreadPool

type

the GstRTSPThreadType

ctx ( [transfer: none])

a GstRTSPContext

Returns ( [transfer: full][nullable])

a new GstRTSPThread, gst_rtsp_thread_stop after usage


GstRtspServer.RTSPThreadPool.prototype.get_thread

function GstRtspServer.RTSPThreadPool.prototype.get_thread(type: GstRtspServer.RTSPThreadType, ctx: GstRtspServer.RTSPContext): {
    // javascript wrapper for 'gst_rtsp_thread_pool_get_thread'
}

Get a new GstRtspServer.RTSPThread for type and ctx.


GstRtspServer.RTSPThreadPool.get_thread

def GstRtspServer.RTSPThreadPool.get_thread (self, type, ctx):
    #python wrapper for 'gst_rtsp_thread_pool_get_thread'

Get a new GstRtspServer.RTSPThread for type and ctx.


gst_rtsp_thread_pool_set_max_threads

gst_rtsp_thread_pool_set_max_threads (GstRTSPThreadPool * pool,
                                      gint max_threads)

Set the maximum threads used by the pool to handle client requests. A value of 0 will use the pool mainloop, a value of -1 will use an unlimited number of threads.

Parameters:

pool

a GstRTSPThreadPool

max_threads

maximum threads


GstRtspServer.RTSPThreadPool.prototype.set_max_threads

function GstRtspServer.RTSPThreadPool.prototype.set_max_threads(max_threads: Number): {
    // javascript wrapper for 'gst_rtsp_thread_pool_set_max_threads'
}

Set the maximum threads used by the pool to handle client requests. A value of 0 will use the pool mainloop, a value of -1 will use an unlimited number of threads.

Parameters:

max_threads (Number)

maximum threads


GstRtspServer.RTSPThreadPool.set_max_threads

def GstRtspServer.RTSPThreadPool.set_max_threads (self, max_threads):
    #python wrapper for 'gst_rtsp_thread_pool_set_max_threads'

Set the maximum threads used by the pool to handle client requests. A value of 0 will use the pool mainloop, a value of -1 will use an unlimited number of threads.

Parameters:

max_threads (int)

maximum threads


Functions

gst_rtsp_thread_pool_cleanup

gst_rtsp_thread_pool_cleanup ()

Wait for all tasks to be stopped and free all allocated resources. This is mainly used in test suites to ensure proper cleanup of internal data structures.


GstRtspServer.RTSPThreadPool.prototype.cleanup

function GstRtspServer.RTSPThreadPool.prototype.cleanup(): {
    // javascript wrapper for 'gst_rtsp_thread_pool_cleanup'
}

Wait for all tasks to be stopped and free all allocated resources. This is mainly used in test suites to ensure proper cleanup of internal data structures.


GstRtspServer.RTSPThreadPool.cleanup

def GstRtspServer.RTSPThreadPool.cleanup ():
    #python wrapper for 'gst_rtsp_thread_pool_cleanup'

Wait for all tasks to be stopped and free all allocated resources. This is mainly used in test suites to ensure proper cleanup of internal data structures.


Properties

max-threads

“max-threads” gint

Flags : Read / Write


max-threads

“max-threads” Number

Flags : Read / Write


max_threads

“self.props.max_threads” int

Flags : Read / Write


Virtual Methods

configure_thread

configure_thread (GstRTSPThreadPool * pool,
                  GstRTSPThread * thread,
                  GstRTSPContext * ctx)

configure a thread object. this vmethod is called when a new thread has been created and should be configured.

Parameters:

pool
No description available
thread
No description available
ctx
No description available

vfunc_configure_thread

function vfunc_configure_thread(pool: GstRtspServer.RTSPThreadPool, thread: GstRtspServer.RTSPThread, ctx: GstRtspServer.RTSPContext): {
    // javascript implementation of the 'configure_thread' virtual method
}

configure a thread object. this vmethod is called when a new thread has been created and should be configured.

Parameters:

No description available
No description available
No description available

do_configure_thread

def do_configure_thread (pool, thread, ctx):
    #python implementation of the 'configure_thread' virtual method

configure a thread object. this vmethod is called when a new thread has been created and should be configured.

Parameters:

No description available
No description available
No description available

get_thread

GstRTSPThread *
get_thread (GstRTSPThreadPool * pool,
            GstRTSPThreadType type,
            GstRTSPContext * ctx)

this function should make or reuse an existing thread that runs a mainloop.

Parameters:

pool
No description available
type
No description available
ctx
No description available
Returns
No description available

vfunc_get_thread

function vfunc_get_thread(pool: GstRtspServer.RTSPThreadPool, type: GstRtspServer.RTSPThreadType, ctx: GstRtspServer.RTSPContext): {
    // javascript implementation of the 'get_thread' virtual method
}

this function should make or reuse an existing thread that runs a mainloop.

Parameters:

No description available
No description available
No description available
Returns (GstRtspServer.RTSPThread)
No description available

do_get_thread

def do_get_thread (pool, type, ctx):
    #python implementation of the 'get_thread' virtual method

this function should make or reuse an existing thread that runs a mainloop.

Parameters:

No description available
No description available
No description available
Returns (GstRtspServer.RTSPThread)
No description available

thread_enter

thread_enter (GstRTSPThreadPool * pool,
              GstRTSPThread * thread)

called from the thread when it is entered

Parameters:

pool
No description available
thread
No description available

vfunc_thread_enter

function vfunc_thread_enter(pool: GstRtspServer.RTSPThreadPool, thread: GstRtspServer.RTSPThread): {
    // javascript implementation of the 'thread_enter' virtual method
}

called from the thread when it is entered

Parameters:

No description available
No description available

do_thread_enter

def do_thread_enter (pool, thread):
    #python implementation of the 'thread_enter' virtual method

called from the thread when it is entered

Parameters:

No description available
No description available

thread_leave

thread_leave (GstRTSPThreadPool * pool,
              GstRTSPThread * thread)

called from the thread when it is left

Parameters:

pool
No description available
thread
No description available

vfunc_thread_leave

function vfunc_thread_leave(pool: GstRtspServer.RTSPThreadPool, thread: GstRtspServer.RTSPThread): {
    // javascript implementation of the 'thread_leave' virtual method
}

called from the thread when it is left

Parameters:

No description available
No description available

do_thread_leave

def do_thread_leave (pool, thread):
    #python implementation of the 'thread_leave' virtual method

called from the thread when it is left

Parameters:

No description available
No description available

Function Macros

GST_RTSP_THREAD_CAST

#define GST_RTSP_THREAD_CAST(obj)   ((GstRTSPThread*)(obj))

GST_RTSP_THREAD_POOL_CAST

#define GST_RTSP_THREAD_POOL_CAST(obj)         ((GstRTSPThreadPool*)(obj))

GST_RTSP_THREAD_POOL_CLASS_CAST

#define GST_RTSP_THREAD_POOL_CLASS_CAST(klass) ((GstRTSPThreadPoolClass*)(klass))

Enumerations

GstRTSPThreadType

Different thread types

Members
GST_RTSP_THREAD_TYPE_CLIENT (0) –

a thread to handle the client communication

GST_RTSP_THREAD_TYPE_MEDIA (1) –

a thread to handle media


GstRtspServer.RTSPThreadType

Different thread types

Members
GstRtspServer.RTSPThreadType.CLIENT (0) –

a thread to handle the client communication

GstRtspServer.RTSPThreadType.MEDIA (1) –

a thread to handle media


GstRtspServer.RTSPThreadType

Different thread types

Members
GstRtspServer.RTSPThreadType.CLIENT (0) –

a thread to handle the client communication

GstRtspServer.RTSPThreadType.MEDIA (1) –

a thread to handle media


The results of the search are