Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

Live555#

Overview#

Live555 is an open-source multimedia streaming library that supports RTP/RTCP and is widely used in streaming-media application development. K230 RTOS SDK integrates Live555 and supports streaming transmission on the K230 platform.

Functional Description#

Live555 Features#

Live555 provides a complete streaming framework:

  • RTP/RTCP

  • RTSP

  • partial SIP support

  • multiple codecs, including H.264, H.265, and AAC

  • cross-platform support

Main Components#

Live555 includes the following major components:

  • UsageEnvironment: base environment for task scheduling and event handling

  • BasicUsageEnvironment: default environment implementation

  • liveMedia: media-processing library

  • groupsock: multicast and unicast networking

Application Scenarios#

On K230, Live555 can be used for:

  • RTSP server /src/rtsmart/mpp/middleware/src/rtsp_server provides the RTSP server wrapper based on Live555, and /src/rtsmart/examples/mpp/sample_rtspserver is the corresponding demo

  • RTSP client /src/rtsmart/mpp/middleware/src/rtsp_client provides the RTSP client wrapper based on Live555, and /src/rtsmart/examples/mpp/sample_rtspclient is the corresponding demo

Build Notes#

Live555 Library Integration#

K230 RTOS SDK already includes prebuilt Live555 libraries in the SDK library directory. Applications can link against them directly.

Usage#

Basic RTSP Server Flow#

Create the usage environment#

#include <BasicUsageEnvironment.hh>
#include <GroupsockHelper.hh>

TaskScheduler* scheduler = BasicTaskScheduler::createNew();
UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);

Create ServerMediaSession#

#include <OnDemandServerMediaSubsession.hh>
#include <H264VideoFileServerMediaSubsession.hh>

RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554);
if (rtspServer == NULL) {
    *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
    exit(1);
}

Add media subsessions#

char const* fileName = "test.264";
ServerMediaSession* sms = ServerMediaSession::createNew(*env, fileName, fileName, True);
sms->addSubsession(H264VideoFileServerMediaSubsession::createNew(*env, fileName, False));
rtspServer->addServerMediaSession(sms);

Start the event loop#

env->taskScheduler().doEventLoop();

Basic RTSP Client Flow#

Create the usage environment#

TaskScheduler* scheduler = BasicTaskScheduler::createNew();
UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);

Create the RTSP client#

#include <RTSPClient.hh>

RTSPClient* rtspClient = RTSPClient::createNew(*env, "rtsp://example.com/video", 0, "k230_client");
if (rtspClient == NULL) {
    *env << "Failed to create RTSP client: " << env->getResultMsg() << "\n";
    exit(1);
}

Send the DESCRIBE command#

MediaSession* session = MediaSession::createNew(*env, rtspClient->describeURL());
if (session == NULL) {
    *env << "Failed to create session: " << env->getResultMsg() << "\n";
    exit(1);
}

Set up RTP reception#

MediaSubsessionIterator* iter = session->setupSubsessionIterator();
MediaSubsession* subsession;
while ((subsession = iter->next()) != NULL) {
    if (!subsession->initiate()) {
        *env << "Failed to initiate subsession: " << subsession->codecName() << "\n";
    } else {
        subsession->sink = createRTPSink(subsession);
        subsession->sink->startPlaying();
    }
}

Start the event loop#

env->taskScheduler().doEventLoop();

Tip

The Live555 event loop is blocking and is usually run in a dedicated thread. For more details, refer to the official Live555 documentation.

Tip

On K230, Live555 can be combined with hardware codecs (VDEC/VENC) and the media pipeline (MPP) to build high-performance streaming applications.

Comments list
Comments
Log in