[Live-devel] Please help: I have difficulties implementing the right classes

Fabrice Triboix fabricet at ovation.co.uk
Thu Sep 4 09:44:30 PDT 2014


Hi Ross,

Thanks for your comment. Here is the implementation of doGetNextFrame() in my class (which is indeed derived from FramedSource):
void CAvSource::doGetNextFrame()
{
    // Forward all frames in the input AV buffer
    while (getTopMetadata() != NULL)
    {
        deliverFrame();
    }
}

void CAvSource::deliverFrame()
{
    av_data_t frame;
    int32_t ret = av_get_variable_frame(mAvBuffer, &frame, POLL_NOWAIT);
    if (ret <= 0)
    {
        log_error("Failed to get frame even if AV buffer told us some are "
                "available for av_buffer %p", mAvBuffer);
        return;
    }

    unsigned size = frame.num_bytes;
    if (size > fMaxSize)
    {
        fFrameSize = fMaxSize;
        fNumTruncatedBytes = size - fMaxSize;
    }
    else
    {
        fFrameSize = size;
        fNumTruncatedBytes = 0;
    }

    memmove(fTo, frame.virt_addr, fFrameSize);

    av_metadata_t* meta = frame.metadata;
    fPresentationTime.tv_sec  = meta->time_usec_then / 1000000LL;
    fPresentationTime.tv_usec = meta->time_usec_then % 1000000LL;
    fDurationInMicroseconds   = meta->time_usec_now - meta->time_usec_then;

    // We don't need the AV frame any more, so we can release it now.
    av_finished_with_variable_frame(mAvBuffer, 1);

    // Inform the reader that a new frame is available.
    FramedSource::afterGetting(this);
}

Could it be that calling deliverFrame() multiple times might be wrong?

Thanks a lot for your help!

  Fabrice

________________________________
From: live-devel [live-devel-bounces at ns.live555.com] on behalf of Ross Finlayson [finlayson at live555.com]
Sent: 04 September 2014 17:21
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] Please help: I have difficulties implementing the right classes


I am trying to build an RTSP server using liveMedia to stream H.264 in real time from a live encoder. In essence, as soon as I try to connect with VLC, liveMedia abort()s with the following message:
FramedSource[0xbe838]::getNextFrame(): attempting to read more than once at the same time!

This error means that a "FramedSource" object (presumably of your subclass that you wrote to deliver live H.264 data from your encoder) is getting a call to "getNextFrame()" while it is already handling a previous call to "getNextFrame()".

I.e., it seems that your "FramedSource" subclass's implementation of "doGetNextFrame()" is incorrect; it apparently is not calling
FramedSource::afterGetting(this);
after it completes delivery to the downstream (i.e., calling) object.

(Also, you should use "testRTSPClient" and/or "openRTSP" as RTSP clients for testing, before using VLC.  VLC is more complex, and is not our software.)


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140904/db850054/attachment-0001.html>


More information about the live-devel mailing list