aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-13 12:06:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-13 12:06:19 +0100
commitde7c95d551881a01cd24885f23bd180fcecc5c07 (patch)
tree055b89369fb437790d85ee55ad8773e5b4ae7283 /libavformat
parent9c0ec23c7dde8a2d6a356fa21cf3339b208467cf (diff)
parent7941159df6aad2d219e2a7184489be7a735dd944 (diff)
downloadffmpeg-de7c95d551881a01cd24885f23bd180fcecc5c07.tar.gz
Merge commit '7941159df6aad2d219e2a7184489be7a735dd944'
* commit '7941159df6aad2d219e2a7184489be7a735dd944': 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: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtpdec.c2
-rw-r--r--libavformat/rtpdec.h30
-rw-r--r--libavformat/rtpenc.h10
3 files changed, 19 insertions, 23 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index f95b364287..b0f0aaa4b0 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -531,7 +531,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
if (ret < 0)
return AVERROR(EAGAIN);
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);
s->read_buf_index = 0;
return 1;
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 15d472a972..74281e78ae 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -31,7 +31,7 @@ typedef struct PayloadContext PayloadContext;
typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
#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
@@ -94,7 +94,8 @@ typedef struct RTPStatistics {
* @param s stream context
* @param st stream that this packet belongs to
* @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 len length of buf
* @param flags flags from the RTP packet header (RTP_FLAG_*)
@@ -108,8 +109,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
int len, int flags);
struct RTPDynamicProtocolHandler_s {
- // fields from AVRtpDynamicPayloadType_s
- const char enc_name[50]; /* XXX: still why 50 ? ;-) */
+ const char enc_name[50];
enum AVMediaType codec_type;
enum AVCodecID codec_id;
int static_payload_id; /* 0 means no payload id is set. 0 is a valid
@@ -137,7 +137,6 @@ typedef struct RTPPacket {
struct RTPPacket *next;
} RTPPacket;
-// moved out of rtp.c, because the h264 decoder needs to know about this structure..
struct RTPDemuxContext {
AVFormatContext *ic;
AVStream *st;
@@ -167,24 +166,21 @@ struct RTPDemuxContext {
/*@}*/
/* rtcp sender statistics receive */
- int64_t last_rtcp_ntp_time; // TODO: move into statistics
- int64_t first_rtcp_ntp_time; // TODO: move into statistics
- uint32_t last_rtcp_timestamp; // TODO: move into statistics
+ int64_t last_rtcp_ntp_time;
+ int64_t first_rtcp_ntp_time;
+ uint32_t last_rtcp_timestamp;
int64_t rtcp_ts_offset;
/* rtcp sender statistics */
- unsigned int packet_count; // TODO: move into statistics (outgoing)
- unsigned int octet_count; // TODO: move into statistics (outgoing)
- unsigned int last_octet_count; // TODO: move into statistics (outgoing)
- int first_packet;
- /* buffer for output */
+ unsigned int packet_count;
+ unsigned int octet_count;
+ unsigned int last_octet_count;
+ /* buffer for partially parsed packets */
uint8_t buf[RTP_MAX_PACKET_LENGTH];
- uint8_t *buf_ptr;
/* dynamic payload stuff */
- DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure
- PayloadContext *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
- int max_frames_per_packet;
+ DynamicPayloadPacketHandlerProc parse_packet;
+ PayloadContext *dynamic_protocol_context;
};
void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h
index bc523b442a..c3607c15a4 100644
--- a/libavformat/rtpenc.h
+++ b/libavformat/rtpenc.h
@@ -38,13 +38,13 @@ struct RTPMuxContext {
int num_frames;
/* rtcp sender statistics receive */
- int64_t last_rtcp_ntp_time; // TODO: move into statistics
- int64_t first_rtcp_ntp_time; // TODO: move into statistics
+ int64_t last_rtcp_ntp_time;
+ int64_t first_rtcp_ntp_time;
/* rtcp sender statistics */
- unsigned int packet_count; // TODO: move into statistics (outgoing)
- unsigned int octet_count; // TODO: move into statistics (outgoing)
- unsigned int last_octet_count; // TODO: move into statistics (outgoing)
+ unsigned int packet_count;
+ unsigned int octet_count;
+ unsigned int last_octet_count;
int first_packet;
/* buffer for output */
uint8_t *buf;