1 #ifndef LIVETHREAD_HEADER_GUARD
2 #define LIVETHREAD_HEADER_GUARD
45 void setLiveOutPacketBuffermaxSize(
unsigned i);
69 void setLiveThread(
void* live_thread);
354 ServerMediaSession *media_session;
355 std::vector<ValkkaServerMediaSubsession*> media_subsessions;
402 EventTriggerId event_trigger_id_hello_world;
403 EventTriggerId event_trigger_id_frame_arrived;
404 EventTriggerId event_trigger_id_got_frames;
408 UserAuthenticationDatabase *authDB;
426 int safeGetSlot (SlotNumber slot,
Connection*& con);
427 int safeGetOutboundSlot (SlotNumber slot,
Outbound*& outbound);
A base class that unifies all kinds of connections (RTSP and SDP).
Definition: livethread.h:185
virtual void reStartStream()
Called from within the live555 event loop.
Definition: livethread.cpp:151
virtual bool isClosed()
Have the streams resources been reclaimed after stopping it?
Definition: livethread.cpp:163
virtual ~Connection()
Default destructor.
Definition: livethread.cpp:145
LiveConnectionContext & ctx
LiveConnectionContext identifying the stream source (address), it's destination (slot and target fram...
Definition: livethread.h:199
virtual void stopStream(bool cut=true)=0
Stops stream and reclaims it resources. Called from within the live555 event loop....
virtual void forceClose()
Normally, stopStream reclaims the resources. This one forces the delete.
Definition: livethread.cpp:167
virtual void reStartStreamIf()
Called from within the live555 event loop.
Definition: livethread.cpp:156
virtual void playStream()=0
Called from within the live555 event loop.
long int pendingtimer
Measures how long stream has been pending.
Definition: livethread.h:212
UsageEnvironment & env
UsageEnvironment identifying the Live555 event loop (see Live555 primer)
Definition: livethread.h:215
SlotNumber getSlot()
Return the slot number.
Definition: livethread.cpp:159
long int frametimer
Measures time when the last frame was received.
Definition: livethread.h:211
FrameFilter * repeat_sps_filter
Repeat sps & pps packets before i-frame (if they were not there before the i-frame)
Definition: livethread.h:209
Passes frames to a FrameFifo.
Definition: framefilter.h:530
A thread-safe combination of a fifo (first-in-first-out) queue and an associated stack.
Definition: framefifo.h:83
FrameFifoContext ctx
Parameters defining the stack and overflow behaviour.
Definition: framefifo.h:93
The mother class of all frame filters! FrameFilters are used to create "filter chains".
Definition: framefilter.h:44
Frame: An abstract queueable class.
Definition: frame.h:112
This is a special FrameFifo class for feeding frames into live555, i.e.
Definition: livethread.h:57
LiveFifo(const char *name, FrameFifoContext ctx)
Default constructor.
Definition: livethread.cpp:50
~LiveFifo()
Default virtual destructor.
Definition: livethread.cpp:53
bool writeCopy(Frame *f, bool wait=false)
Take a frame "ftmp" from the stack, copy contents of "f" into "ftmp" and insert "ftmp" into the begin...
Definition: livethread.cpp:62
Live555, running in a separate thread.
Definition: livethread.h:372
static void helloWorldEvent(void *clientData)
For testing/debugging
Definition: livethread.cpp:1377
FifoFrameFilter infilter
A FrameFilter for writing incoming frames.
Definition: livethread.h:389
void closePending()
Force close all pending connections.
Definition: livethread.cpp:896
static void readFrameFifoTask(void *clientData)
This task registers itself if there are frames in the fifo.
Definition: livethread.cpp:1405
int fc
debugging: incoming frame counter
Definition: livethread.h:405
void handleSignals()
Handle pending signals in the signals queue. Used by LiveThread::periodicTask.
Definition: livethread.cpp:906
void checkAlive()
Used by LiveThread::periodicTask.
Definition: livethread.cpp:862
char eventLoopWatchVariable
Modifying this, kills the Live555 event loop.
Definition: livethread.h:397
static void frameArrivedEvent(void *clientData)
For debugging.
Definition: livethread.cpp:1383
void deregisterOutboundCall(LiveOutboundContext &outbound_ctx)
API method: deregister outbound stream // <pyapi>
Definition: livethread.cpp:1284
static void gotFramesEvent(void *clientData)
Triggered when an empty fifo gets a frame. Schedules readFrameFifoTask. See Live streaming.
Definition: livethread.cpp:1396
void preRun()
Called before entering the main execution loop, but after creating the thread.
Definition: livethread.cpp:849
void triggerGotFrames()
See Live streaming.
Definition: livethread.cpp:1442
LiveFifo infifo
A FrameFifo for incoming frames.
Definition: livethread.h:388
std::vector< Connection * > slots_
A constant sized vector. Book-keeping of the connections (RTSP or SDP) currently active in the live55...
Definition: livethread.h:398
std::vector< Outbound * > out_slots_
Book-keeping for the outbound connections.
Definition: livethread.h:399
UsageEnvironment * env
Live555 UsageEnvironment identifying the event loop.
Definition: livethread.h:396
TaskScheduler * scheduler
Live555 event loop TaskScheduler.
Definition: livethread.h:395
std::deque< LiveSignalContext > signal_fifo
Redefinition of signal fifo (Thread::signal_fifo becomes hidden)
Definition: livethread.h:392
void handleFrame(Frame *f)
Handle incoming frames. See Live streaming.
Definition: livethread.cpp:966
static void periodicTask(void *cdata)
Used to (re)schedule LiveThread methods into the live555 event loop.
Definition: livethread.cpp:1227
void registerOutboundCall(LiveOutboundContext &outbound_ctx)
API method: register outbound stream // <pyapi>
Definition: livethread.cpp:1278
void registerStreamCall(LiveConnectionContext &connection_ctx)
API method: registers a stream // <pyapi>
Definition: livethread.cpp:1256
bool exit_requested
Exit asap.
Definition: livethread.h:401
void setRTSPServer(int portnum=8554)
API method: activate the RTSP server at port portnum // <pyapi>
Definition: livethread.cpp:1326
void run()
Main execution loop is defined here.
Definition: livethread.cpp:987
FifoFrameFilter & getFrameFilter()
API method: get filter for sending frames with live555 // <pyapi>
Definition: livethread.cpp:1321
virtual void waitReady()
API method: wait until all signals and pending connections are resolved // <pyapi>
Definition: livethread.cpp:1304
void handlePending()
Try to close streams that were not properly closed (i.e. idling for the tcp socket while closing)....
Definition: livethread.cpp:876
void stopStreamCall(LiveConnectionContext &connection_ctx)
API method: stops playing the stream and feeding frames // <pyapi>
Definition: livethread.cpp:1272
void testTrigger()
See Live streaming.
Definition: livethread.cpp:1436
void deregisterStreamCall(LiveConnectionContext &connection_ctx)
API method: de-registers a stream // <pyapi>
Definition: livethread.cpp:1261
void postRun()
Called after the main execution loop exits, but before joining the thread.
Definition: livethread.cpp:853
void sendSignal(LiveSignalContext signal_ctx)
Send a signal to the thread.
Definition: livethread.cpp:856
void playStreamCall(LiveConnectionContext &connection_ctx)
API method: starts playing the stream and feeding frames // <pyapi>
Definition: livethread.cpp:1267
void requestStopCall()
API method: Like Thread::stopCall() but does not block // <pyapi>
Definition: livethread.cpp:1291
LiveThread(const char *name, FrameFifoContext fifo_ctx=FrameFifoContext())
Default constructor.
Definition: livethread.cpp:790
std::list< Connection * > pending
Incoming connections pending for closing.
Definition: livethread.h:400
A base class that unifies all kinds of outgoing streams (i.e.
Definition: livethread.h:237
Outbound(UsageEnvironment &env, FrameFifo &fifo, LiveOutboundContext &ctx)
Default constructor.
Definition: livethread.cpp:174
LiveOutboundContext & ctx
Identifies the connection type, stream address, etc. See LiveOutboundContext.
Definition: livethread.h:244
virtual void reinit()
Reset session and subsessions.
Definition: livethread.cpp:177
bool at_setup
Flags used by Outbound::handleFrame.
Definition: livethread.h:249
virtual ~Outbound()
Default virtual destructor.
Definition: livethread.cpp:175
UsageEnvironment & env
Identifies the live555 event loop.
Definition: livethread.h:245
virtual void handleFrame(Frame *f)
Setup session and subsessions, writes payload.
Definition: livethread.cpp:183
FrameFifo & fifo
Outgoing fFrames are being read and finally recycled here.
Definition: livethread.h:246
A negotiated RTSP connection.
Definition: livethread.h:263
void forceClose()
Normally, stopStream reclaims the resources. This one forces the delete.
Definition: livethread.cpp:421
void reStartStreamIf()
Restarts the stream if no frames have been received for a while.
Definition: livethread.cpp:329
RTSPConnection(UsageEnvironment &env, LiveConnectionContext &ctx)
Default constructor.
Definition: livethread.cpp:258
void playStream()
Uses ValkkaRTSPClient instance to initiate the RTSP negotiation.
Definition: livethread.cpp:271
LiveStatus livestatus
Reference of this variable is passed to ValkkaRTSPClient. We can see outside of the live555 callback ...
Definition: livethread.h:274
ValkkaRTSPClient * client
ValkkaRTSPClient defines the behaviour (i.e. event registration and callbacks) of the RTSP client (se...
Definition: livethread.h:273
bool termplease
Ref of this var is passed to ValkkaRTSPClient. When set to true, ValkkaRTSPClient should terminate it...
Definition: livethread.h:275
void stopStream(bool cut=true)
Uses ValkkaRTSPClient instance to shut down the stream.
Definition: livethread.cpp:292
bool isClosed()
Have the streams resources been reclaimed?
Definition: livethread.cpp:417
Sending a stream using the on-demand rtsp server.
Definition: livethread.h:340
RTSPServer & server
Reference to the RTSPServer instance.
Definition: livethread.h:347
void handleFrame(Frame *f)
Setup session and subsessions, writes payload.
Definition: livethread.cpp:676
void reinit()
Reset session and subsessions.
Definition: livethread.cpp:643
Connection is is defined in an SDP file.
Definition: livethread.h:290
void playStream()
Creates Live555 MediaSessions, MediaSinks, etc. instances and registers them directly to the Live555 ...
Definition: livethread.cpp:434
SDPConnection(UsageEnvironment &env, LiveConnectionContext &ctx)
Default constructor.
Definition: livethread.cpp:428
~SDPConnection()
Default destructor.
Definition: livethread.cpp:431
void stopStream(bool cut=true)
Closes Live555 MediaSessions, MediaSinks, etc.
Definition: livethread.cpp:530
Sending a stream without rtsp negotiation (i.e.
Definition: livethread.h:317
std::vector< Stream * > streams
SubStreams of the outgoing streams (typically two, e.g. video and sound)
Definition: livethread.h:328
void handleFrame(Frame *f)
Setup session and subsessions, writes payload.
Definition: livethread.cpp:563
void reinit()
Reset session and subsessions.
Definition: livethread.cpp:551
Class to hold per-stream state that we maintain throughout each stream's lifetime.
Definition: live.h:78
A class for multithreading with a signaling system.
Definition: thread.h:87
std::string name
Name of the thread.
Definition: thread.h:116
Handles a live555 RTSP connection.
Definition: live.h:111
TimeCorrectionType
Methods to correct frame timestamps.
Definition: frame.h:87
Thread safe system of fifo and a stack.
Definition of FrameFilter and derived classes for various purposes.
LiveStatus
Status for the ValkkaRTSPClient.
Definition: live.h:62
LiveConnectionType
LiveThread connection types.
Definition: livethread.h:80
Connection(UsageEnvironment &env, LiveConnectionContext &ctx)
Default constructor.
Definition: livethread.cpp:123
Live555 interface for server side: streaming to udp sockets directly or by using an on-demand rtsp se...
LiveSignal
Characteristic signals for the Live555 thread.
Definition: livethread.h:149
Describes the stack structure and fifo behaviour for a FrameFifo.
Definition: framefifo.h:56
Identifies a stream and encapsulates information about the type of connection the user is requesting ...
Definition: livethread.h:97
TimeCorrectionType time_correction
How to perform frame timestamp correction // <pyapi>
Definition: livethread.h:119
LiveConnectionContext(LiveConnectionType ct, std::string address, SlotNumber slot, FrameFilter *framefilter)
Default constructor.
Definition: livethread.h:99
std::string address
Stream address // <pyapi>
Definition: livethread.h:111
SlotNumber slot
A unique stream slot that identifies this stream // <pyapi>
Definition: livethread.h:112
long unsigned int msreconnect
If stream has delivered nothing during this many milliseconds, reconnect // <pyapi>
Definition: livethread.h:114
unsigned reordering_time
Live555 packet reordering treshold time (microsecs) // <pyapi>
Definition: livethread.h:118
LiveConnectionType connection_type
Identifies the connection type // <pyapi>
Definition: livethread.h:110
bool request_multicast
Request multicast in the rtsp negotiation or not // <pyapi>
Definition: livethread.h:115
bool request_tcp
Request interleaved rtsp streaming or not // <pyapi>
Definition: livethread.h:116
FrameFilter * framefilter
The frames are feeded into this FrameFilter // <pyapi>
Definition: livethread.h:113
unsigned recv_buffer_size
Operating system ringbuffer size for incoming socket // <pyapi>
Definition: livethread.h:117
LiveConnectionContext()
Dummy constructor : remember to set member values by hand.
Definition: livethread.h:106
Same as LiveConnectionContext, but for outbound streams (i.e.
Definition: livethread.h:127
SlotNumber slot
A unique stream slot that identifies this stream // <pyapi>
Definition: livethread.h:137
unsigned short int portnum
Start port number (for sdp) // <pyapi>
Definition: livethread.h:138
std::string address
Stream address // <pyapi>
Definition: livethread.h:136
unsigned char ttl
Packet time-to-live // <pyapi>
Definition: livethread.h:139
LiveConnectionType connection_type
Identifies the connection type // <pyapi>
Definition: livethread.h:135
Identifies the information the signals LiveThread::Signals carry.
Definition: livethread.h:166
Base class for multithreading.
@ none
undefined (initial value)
Definition: usbthread.h:143