[Live-devel] [Mirasys] Live555 RTSP server questions

Ross Finlayson finlayson at live555.com
Wed Jan 12 02:57:19 PST 2022


Your "H264ServerMediaSubsession::createNewStreamSource()” function needs to create a *new* “H264FramedSource” object each time it’s called.  You can’t create just one of those objects in advance, and try to reuse it.  So this code is wrong:

> H264ServerMediaSubsession::H264ServerMediaSubsession(UsageEnvironment& env, Boolean reuseFirstSource) :
>    OnDemandServerMediaSubsession(env, reuseFirstSource)
> {
>    mFramedSource = H264FramedSource::createNew(env);
> }
> 
> H264ServerMediaSubsession::~H264ServerMediaSubsession() {
>    Medium::close(mFramedSource);
> }
> 
> FramedSource* H264ServerMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
>    estBitrate = 500; // kbps, estimate
> 
>    // Create a framer for the Video Elementary Stream:
>    return H264VideoStreamDiscreteFramer::createNew(envir(), mFramedSource);
> }


You should not be creating (or destroying) “H264FramedSource” objects in your “H264ServerMediaSubsession” constructor (or destructor).  Instead, you create a "H264FramedSource” object in your "H264ServerMediaSubsession::createNewStreamSource()” function.  (It will get destroyed automatically when it’s no longer needed.)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list