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