[Live-devel] Frames are corrupted
Vikram Singh
vikram at vizexperts.com
Fri Apr 18 08:59:09 PDT 2014
Hi Ross,
- I am still not able to resolve the issue.
- I would like to elaborate my issue. Basically I want to stream
frames I grab from a opengl windows and I get these frames in encoded h264
format
- The following is my code for the thread that starts RTSP streaming.
int RTSPStreamer::Main()
{
TaskScheduler* taskSchedular = BasicTaskScheduler::createNew();
BasicUsageEnvironment* usageEnvironment =
BasicUsageEnvironment::createNew(*taskSchedular);
RTSPServer* rtspServer = RTSPServer::createNew(*usageEnvironment, 8554,
NULL);
if(rtspServer == NULL)
{
*usageEnvironment << "Failed to create rtsp server ::" <<
usageEnvironment->getResultMsg() <<"\n";
exit(1);
}
std::string streamName = "usb1.mkv";
ServerMediaSession* sms =
ServerMediaSession::createNew(*usageEnvironment, streamName.c_str(),
streamName.c_str(), "Live H264 Stream");
H264LiveServerMediaSession *liveSubSession =
H264LiveServerMediaSession::createNew(*usageEnvironment, true,
rtspStreamQueue);
sms->addSubsession(liveSubSession);
rtspServer->addServerMediaSession(sms);
char* url = rtspServer->rtspURL(sms);
*usageEnvironment << "Play the stream using url "<<url << "\n";
delete[] url;
taskSchedular->doEventLoop();
return 0;
}
- I have written a custom class H264LiveServerMediaSession which get
frames from rtspStreamQueue.
- In H264LiveServerMediaSession the function createNewStreamSource()
creates an instance of LiveSourceWithx264 which is basically responsible for
getting the frame from rtspStreamQueue.
- In the function deliverFrame() > fMaxSize will start at 15000
- In the next call to deliverFrame() à fMaxSize will be 15000-size
of frame in previous call.
- I think this should now happen and .
- Can you suggest me what I did wrong. I have attached the files
H264LiveServerMediaSession and LiveSourceWithx264.
- I am new to live555 and please help me out.
Thanks and Regards,
Vikram Singh.
From: live-devel-bounces at ns.live555.com
[mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: Tuesday, April 15, 2014 8:26 PM
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] Frames are corrupted
But if fFrameSize is greater than fMaxSize then I have to truncate the data.
I think this is what that is causing the corrupted frames.
Yes, because if a frame has to be truncated, then the truncated data will be
lost (i.e., not sent to the client).
Is there any way to get around this problem.
Yes, there are two possible solutions.
1/ The best solution is to not send such large NAL units. Reconfigure your
encoder to break up 'key frames' into multiple (therefore much smaller)
'slice' NAL units.
2/ Alternatively (though not as good), you can increase the size of the
server's output buffer.
Try adding the following line to your application - at the start of
"main()":
OutPacketBuffer::maxSize = 100000;
and recompile. If that doesn't work, try increasing to 150000, 200000,
etc., depending on the size of your frames.
It's important to understand, though, that this is a bad solution. See:
http://lists.live555.com/pipermail/live-devel/2013-April/016805.html
1/ is a *much* better solution - i.e., decrease the size of the NAL units
that you're streaming.
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/20140418/a47d0066/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LiveSourceWithx264.cpp
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140418/a47d0066/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: H264LiveServerMediaSession.cpp
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140418/a47d0066/attachment-0003.ksh>
More information about the live-devel
mailing list