* [FFmpeg-devel] [PATCH 1/3] avformat/rtpdec: Fix negative missed packets in warning message
@ 2022-01-23 3:51 lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/rtpdec: return value check for init_get_bits() lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times lance.lmwang
0 siblings, 2 replies; 5+ messages in thread
From: lance.lmwang @ 2022-01-23 3:51 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavformat/rtpdec.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 20fe2b8..f285a41 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -835,9 +835,14 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
if (s->queue_len <= 0)
return -1;
- if (!has_next_packet(s))
+ if (!has_next_packet(s)) {
+ int pkt_missed = s->queue->seq - s->seq - 1;
+
+ if (pkt_missed < 0)
+ pkt_missed += UINT16_MAX;
av_log(s->ic, AV_LOG_WARNING,
- "RTP: missed %d packets\n", s->queue->seq - s->seq - 1);
+ "RTP: missed %d packets\n", pkt_missed);
+ }
/* Parse the first packet in the queue, and dequeue it */
rv = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len);
--
1.8.3.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] avformat/rtpdec: return value check for init_get_bits()
2022-01-23 3:51 [FFmpeg-devel] [PATCH 1/3] avformat/rtpdec: Fix negative missed packets in warning message lance.lmwang
@ 2022-01-23 3:51 ` lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times lance.lmwang
1 sibling, 0 replies; 5+ messages in thread
From: lance.lmwang @ 2022-01-23 3:51 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavformat/rtpdec_h261.c | 4 +++-
libavformat/rtpdec_h263_rfc2190.c | 4 +++-
libavformat/rtpdec_latm.c | 4 +++-
libavformat/rtpdec_mpeg4.c | 5 ++++-
libavformat/rtpdec_qt.c | 4 +++-
5 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/libavformat/rtpdec_h261.c b/libavformat/rtpdec_h261.c
index a102909..57bc10f 100644
--- a/libavformat/rtpdec_h261.c
+++ b/libavformat/rtpdec_h261.c
@@ -119,7 +119,9 @@ static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx
} else {
/* ebit/sbit values inconsistent, assuming packet loss */
GetBitContext gb;
- init_get_bits(&gb, buf, len*8 - ebit);
+ res = init_get_bits(&gb, buf, len*8 - ebit);
+ if (res < 0)
+ return res;
skip_bits(&gb, sbit);
if (rtp_h261_ctx->endbyte_bits) {
rtp_h261_ctx->endbyte |= get_bits(&gb, 8 - rtp_h261_ctx->endbyte_bits);
diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c
index a0f587f..47aaec0 100644
--- a/libavformat/rtpdec_h263_rfc2190.c
+++ b/libavformat/rtpdec_h263_rfc2190.c
@@ -142,7 +142,9 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
} else {
/* Start/end skip bits not matching - missed packets? */
GetBitContext gb;
- init_get_bits(&gb, buf, len*8 - ebit);
+ ret = init_get_bits(&gb, buf, len*8 - ebit);
+ if (ret < 0)
+ return ret;
skip_bits(&gb, sbit);
if (data->endbyte_bits) {
data->endbyte |= get_bits(&gb, 8 - data->endbyte_bits);
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index 104a00a..329b8db 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -101,7 +101,9 @@ static int parse_fmtp_config(AVStream *st, const char *value)
if (!config)
return AVERROR(ENOMEM);
ff_hex_to_data(config, value);
- init_get_bits(&gb, config, len*8);
+ ret = init_get_bits(&gb, config, len*8);
+ if (ret < 0)
+ return ret;
audio_mux_version = get_bits(&gb, 1);
same_time_framing = get_bits(&gb, 1);
skip_bits(&gb, 6); /* num_sub_frames */
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index 34c7950..723b6fc 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -124,6 +124,7 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
{
int au_headers_length, au_header_size, i;
GetBitContext getbitcontext;
+ int ret;
if (len < 2)
return AVERROR_INVALIDDATA;
@@ -144,7 +145,9 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
if (len < data->au_headers_length_bytes)
return AVERROR_INVALIDDATA;
- init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
+ ret = init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
+ if (ret < 0)
+ return ret;
/* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
au_header_size = data->sizelength + data->indexlength;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 6723cd1..495a3ec 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -82,7 +82,9 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
* The RTP payload is described in:
* http://developer.apple.com/quicktime/icefloe/dispatch026.html
*/
- init_get_bits(&gb, buf, len << 3);
+ ret = init_get_bits(&gb, buf, len << 3);
+ if (ret < 0)
+ return ret;
ffio_init_context(&pb0, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL);
if (len < 4)
--
1.8.3.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times
2022-01-23 3:51 [FFmpeg-devel] [PATCH 1/3] avformat/rtpdec: Fix negative missed packets in warning message lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/rtpdec: return value check for init_get_bits() lance.lmwang
@ 2022-01-23 3:51 ` lance.lmwang
2022-01-24 3:48 ` Steven Liu
1 sibling, 1 reply; 5+ messages in thread
From: lance.lmwang @ 2022-01-23 3:51 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
libavformat/dashdec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 0d21989..211d77f 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -403,6 +403,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
DASHContext *c = s->priv_data;
AVDictionary *tmp = NULL;
const char *proto_name = NULL;
+ int proto_name_len;
int ret;
if (av_strstart(url, "crypto", NULL)) {
@@ -416,6 +417,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
if (!proto_name)
return AVERROR_INVALIDDATA;
+ proto_name_len = strlen(proto_name);
// only http(s) & file are allowed
if (av_strstart(proto_name, "file", NULL)) {
if (strcmp(c->allowed_extensions, "ALL") && !av_match_ext(url, c->allowed_extensions)) {
@@ -430,9 +432,9 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
} else
return AVERROR_INVALIDDATA;
- if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
+ if (!strncmp(proto_name, url, proto_name_len) && url[proto_name_len] == ':')
;
- else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')
+ else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, proto_name_len) && url[7 + proto_name_len] == ':')
;
else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
return AVERROR_INVALIDDATA;
--
1.8.3.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times lance.lmwang
@ 2022-01-24 3:48 ` Steven Liu
2022-01-30 5:40 ` lance.lmwang
0 siblings, 1 reply; 5+ messages in thread
From: Steven Liu @ 2022-01-24 3:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Limin Wang
<lance.lmwang@gmail.com> 于2022年1月23日周日 11:52写道:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavformat/dashdec.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 0d21989..211d77f 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -403,6 +403,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> DASHContext *c = s->priv_data;
> AVDictionary *tmp = NULL;
> const char *proto_name = NULL;
> + int proto_name_len;
> int ret;
>
> if (av_strstart(url, "crypto", NULL)) {
> @@ -416,6 +417,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> if (!proto_name)
> return AVERROR_INVALIDDATA;
>
> + proto_name_len = strlen(proto_name);
> // only http(s) & file are allowed
> if (av_strstart(proto_name, "file", NULL)) {
> if (strcmp(c->allowed_extensions, "ALL") && !av_match_ext(url, c->allowed_extensions)) {
> @@ -430,9 +432,9 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> } else
> return AVERROR_INVALIDDATA;
>
> - if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
> + if (!strncmp(proto_name, url, proto_name_len) && url[proto_name_len] == ':')
> ;
> - else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')
> + else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, proto_name_len) && url[7 + proto_name_len] == ':')
> ;
> else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> return AVERROR_INVALIDDATA;
> --
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
lgtm
Thanks
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times
2022-01-24 3:48 ` Steven Liu
@ 2022-01-30 5:40 ` lance.lmwang
0 siblings, 0 replies; 5+ messages in thread
From: lance.lmwang @ 2022-01-30 5:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, Jan 24, 2022 at 11:48:22AM +0800, Steven Liu wrote:
> <lance.lmwang@gmail.com> 于2022年1月23日周日 11:52写道:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavformat/dashdec.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> > index 0d21989..211d77f 100644
> > --- a/libavformat/dashdec.c
> > +++ b/libavformat/dashdec.c
> > @@ -403,6 +403,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> > DASHContext *c = s->priv_data;
> > AVDictionary *tmp = NULL;
> > const char *proto_name = NULL;
> > + int proto_name_len;
> > int ret;
> >
> > if (av_strstart(url, "crypto", NULL)) {
> > @@ -416,6 +417,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> > if (!proto_name)
> > return AVERROR_INVALIDDATA;
> >
> > + proto_name_len = strlen(proto_name);
> > // only http(s) & file are allowed
> > if (av_strstart(proto_name, "file", NULL)) {
> > if (strcmp(c->allowed_extensions, "ALL") && !av_match_ext(url, c->allowed_extensions)) {
> > @@ -430,9 +432,9 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
> > } else
> > return AVERROR_INVALIDDATA;
> >
> > - if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
> > + if (!strncmp(proto_name, url, proto_name_len) && url[proto_name_len] == ':')
> > ;
> > - else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')
> > + else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, proto_name_len) && url[7 + proto_name_len] == ':')
> > ;
> > else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> > return AVERROR_INVALIDDATA;
> > --
> > 1.8.3.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
> lgtm
thanks, will push the patch set tomorrow if no other comments.
>
>
> Thanks
--
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-30 5:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 3:51 [FFmpeg-devel] [PATCH 1/3] avformat/rtpdec: Fix negative missed packets in warning message lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/rtpdec: return value check for init_get_bits() lance.lmwang
2022-01-23 3:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: avoid calling strlen multiple times lance.lmwang
2022-01-24 3:48 ` Steven Liu
2022-01-30 5:40 ` lance.lmwang
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git