[Ffmpeg-devel] Image blurs in case of packet loss when using h.263 codec
Zhang Yong
z-yong163
Sat Jun 11 15:12:30 CEST 2005
Dear all,
Recently, I am trying to use libavcodec to develop a network video
application under Windows. Because it is a video conferencing application, I
chose the h.263 codec, and used the UDP transport protocol to transfer the
encoded data on the network. But since UDP is not a reliable protocol,
whenever packet loss occurs, there are serious image blurs on the decoded
image of the receiver.
The blurred image is *attached*. I don't know whether this is an inherent
property of the h.263 codec. If so, how can I avoid image blurs in case of
packet loss? I have been tangled with this issue for about two weeks. It
will be very appreciated if anybody could help me out. Thanks.
The following is my code to decode frames:
BOOL RecvVideoWnd::decodeOneFrame(LPBYTE data, int size)
{
int got_picture;
int n = avcodec_decode_video(decoder, yuvFrame, &got_picture, data,
size);
if (n < 0 || !got_picture)
return FALSE;
img_convert((AVPicture *) rgbFrame, PIX_FMT_RGB24,
(AVPicture *) yuvFrame, decoder->pix_fmt,
videoFormat.biWidth, videoFormat.biHeight);
// Repaint the receiver window
Invalidate();
return TRUE;
}
void RecvVideoWnd::onDataReceived(LPBYTE data, int size)
{
uint8_t *outbuf;
int outbuf_size;
int len;
while (size > 0) {
len = av_parser_parse(parser, decoder, &outbuf,
&outbuf_size,
(LPBYTE) data, size, AV_NOPTS_VALUE,
AV_NOPTS_VALUE);
if (outbuf_size > 0)
decodeOneFrame(outbuf, outbuf_size);
data += len;
size -= len;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blurs.png
Type: image/png
Size: 39445 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050611/c8a662c6/attachment.png>
More information about the ffmpeg-devel
mailing list