[Live-devel] loosing information when parse a frame and fMaxsize is less than frame size
Manuel Jesus Nogales
mnogales at vdx.es
Wed Nov 29 17:00:21 PST 2006
Hello
I am a newbie working with live555. I have adapted the
testOnDemandRTSPServer, and I have developed my own class
miVideoServerMediaSubsession (: public OnDemandServerMediaSubsession)
and class miStreamBufferSource (: public FramedSource) in order to
obtain my source from a camera.
It works fine but in the method
miVideoServerMediaSubsession::doGetNextFrame(), when I got a frame
(stored in my buffer from my MPEG1 encoder) with size bigger that
fMaxSize(in that moment) ,then I must to truncate information from that
frame in order to could write at the fTo pointer.
Is there any way to order the StreamParser to change to the other Bank?
I suppouse, it would restore the value of the fMaxSize to 150000 and
then I will write all the frame and I will not lose any information.
my doGetNextFrame()
{
......
num_bytes_codificados = m_video->codifica((char
*)g_buffer_imagen,TAMANO_BUFFER_IMAGEN,0);
/ * my encode method, g_buffer_imagen (global variable buffer, store
image at pgm format) -> g_buffer_codificado (global variable buffer,
store actual frame of MPEG1 encoding), the method return the number of
bytes of the encoded frame = size of g_buffer_codificado
*/
printf("PUNTO1 num_bytes_codificados: %d, fMaxSize:
%d\n",num_bytes_codificados,fMaxSize);
if(num_bytes_codificados == -1)
{
fFrameSize = 0;
perror("------------");
return -1;
}
else
fFrameSize = num_bytes_codificados;
if (fFrameSize > fMaxSize)
{
fNumTruncatedBytes = fFrameSize - fMaxSize;
fFrameSize = fMaxSize;
}
memcpy(fTo,g_buffer_codificado,fFrameSize);
printf("PUNTO2 fFrameSize: %d , fMaxSize: %d\n",fFrameSize,fMaxSize );
FramedSource::afterGetting(this);
return 0;
}
I know I am loosing information cause when I saw with my cliente
"mplayer" the stream sometimes appear a frame with "bad" blocks.
I hope anyone could help me, Thanks in advance.
///
/
More information about the live-devel
mailing list