Commit de7c95d5 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7941159d'

* commit '7941159d':
  rtpdec/enc: Remove outdated/useless/misleading comments
  rtpdec: Improve some comments
  rtpdec: Remove unused context variables
  rtpdec: Limit writing to the buffer size
  svq1: Fix building with -DDEBUG
  svq1: return meaningful error codes.

Conflicts:
	libavcodec/svq1dec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9c0ec23c 7941159d
...@@ -531,7 +531,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, ...@@ -531,7 +531,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
if (ret < 0) if (ret < 0)
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
if (ret < len) { if (ret < len) {
s->read_buf_size = len - ret; s->read_buf_size = FFMIN(len - ret, sizeof(s->buf));
memcpy(s->buf, buf + ret, s->read_buf_size); memcpy(s->buf, buf + ret, s->read_buf_size);
s->read_buf_index = 0; s->read_buf_index = 0;
return 1; return 1;
......
...@@ -31,7 +31,7 @@ typedef struct PayloadContext PayloadContext; ...@@ -31,7 +31,7 @@ typedef struct PayloadContext PayloadContext;
typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
#define RTP_MIN_PACKET_LENGTH 12 #define RTP_MIN_PACKET_LENGTH 12
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */ #define RTP_MAX_PACKET_LENGTH 1500
#define RTP_REORDER_QUEUE_DEFAULT_SIZE 10 #define RTP_REORDER_QUEUE_DEFAULT_SIZE 10
...@@ -94,7 +94,8 @@ typedef struct RTPStatistics { ...@@ -94,7 +94,8 @@ typedef struct RTPStatistics {
* @param s stream context * @param s stream context
* @param st stream that this packet belongs to * @param st stream that this packet belongs to
* @param pkt packet in which to write the parsed data * @param pkt packet in which to write the parsed data
* @param timestamp pointer in which to write the timestamp of this RTP packet * @param timestamp pointer to the RTP timestamp of the input data, can be
* updated by the function if returning older, buffered data
* @param buf pointer to raw RTP packet data * @param buf pointer to raw RTP packet data
* @param len length of buf * @param len length of buf
* @param flags flags from the RTP packet header (RTP_FLAG_*) * @param flags flags from the RTP packet header (RTP_FLAG_*)
...@@ -108,8 +109,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx, ...@@ -108,8 +109,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
int len, int flags); int len, int flags);
struct RTPDynamicProtocolHandler_s { struct RTPDynamicProtocolHandler_s {
// fields from AVRtpDynamicPayloadType_s const char enc_name[50];
const char enc_name[50]; /* XXX: still why 50 ? ;-) */
enum AVMediaType codec_type; enum AVMediaType codec_type;
enum AVCodecID codec_id; enum AVCodecID codec_id;
int static_payload_id; /* 0 means no payload id is set. 0 is a valid int static_payload_id; /* 0 means no payload id is set. 0 is a valid
...@@ -137,7 +137,6 @@ typedef struct RTPPacket { ...@@ -137,7 +137,6 @@ typedef struct RTPPacket {
struct RTPPacket *next; struct RTPPacket *next;
} RTPPacket; } RTPPacket;
// moved out of rtp.c, because the h264 decoder needs to know about this structure..
struct RTPDemuxContext { struct RTPDemuxContext {
AVFormatContext *ic; AVFormatContext *ic;
AVStream *st; AVStream *st;
...@@ -167,24 +166,21 @@ struct RTPDemuxContext { ...@@ -167,24 +166,21 @@ struct RTPDemuxContext {
/*@}*/ /*@}*/
/* rtcp sender statistics receive */ /* rtcp sender statistics receive */
int64_t last_rtcp_ntp_time; // TODO: move into statistics int64_t last_rtcp_ntp_time;
int64_t first_rtcp_ntp_time; // TODO: move into statistics int64_t first_rtcp_ntp_time;
uint32_t last_rtcp_timestamp; // TODO: move into statistics uint32_t last_rtcp_timestamp;
int64_t rtcp_ts_offset; int64_t rtcp_ts_offset;
/* rtcp sender statistics */ /* rtcp sender statistics */
unsigned int packet_count; // TODO: move into statistics (outgoing) unsigned int packet_count;
unsigned int octet_count; // TODO: move into statistics (outgoing) unsigned int octet_count;
unsigned int last_octet_count; // TODO: move into statistics (outgoing) unsigned int last_octet_count;
int first_packet; /* buffer for partially parsed packets */
/* buffer for output */
uint8_t buf[RTP_MAX_PACKET_LENGTH]; uint8_t buf[RTP_MAX_PACKET_LENGTH];
uint8_t *buf_ptr;
/* dynamic payload stuff */ /* dynamic payload stuff */
DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure DynamicPayloadPacketHandlerProc parse_packet;
PayloadContext *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me. PayloadContext *dynamic_protocol_context;
int max_frames_per_packet;
}; };
void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler); void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
......
...@@ -38,13 +38,13 @@ struct RTPMuxContext { ...@@ -38,13 +38,13 @@ struct RTPMuxContext {
int num_frames; int num_frames;
/* rtcp sender statistics receive */ /* rtcp sender statistics receive */
int64_t last_rtcp_ntp_time; // TODO: move into statistics int64_t last_rtcp_ntp_time;
int64_t first_rtcp_ntp_time; // TODO: move into statistics int64_t first_rtcp_ntp_time;
/* rtcp sender statistics */ /* rtcp sender statistics */
unsigned int packet_count; // TODO: move into statistics (outgoing) unsigned int packet_count;
unsigned int octet_count; // TODO: move into statistics (outgoing) unsigned int octet_count;
unsigned int last_octet_count; // TODO: move into statistics (outgoing) unsigned int last_octet_count;
int first_packet; int first_packet;
/* buffer for output */ /* buffer for output */
uint8_t *buf; uint8_t *buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment