/*
* RTP packetization for MPEG video
- * Copyright (c) 2002 Fabrice Bellard.
- * Copyright (c) 2007 Luca Abeni.
+ * Copyright (c) 2002 Fabrice Bellard
+ * Copyright (c) 2007 Luca Abeni
*
* This file is part of FFmpeg.
*
#include "libavcodec/mpegvideo.h"
#include "avformat.h"
-#include "rtp_internal.h"
+#include "rtp.h"
/* NOTE: a single frame must be passed with sequence header if
needed. XXX: use slices. */
begin_of_sequence = 1;
}
- if (r - buf1 < len) {
+ if (r - buf1 - 4 <= len) {
/* The current slice fits in the packet */
if (begin_of_slice == 0) {
/* no slice at the beginning of the packet... */
}
r1 = r;
} else {
- if (r - r1 < max_packet_size) {
+ if ((r1 - buf1 > 4) && (r - r1 < max_packet_size)) {
len = r1 - buf1 - 4;
end_of_slice = 1;
}
memcpy(q, buf1, len);
q += len;
- /* 90 KHz time stamp */
+ /* 90kHz time stamp */
s->timestamp = s->cur_timestamp;
ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size));