diff mbox series

[FFmpeg-devel,2/2] avformat/rtsp: allocate correct max number of pollfds

Message ID 20200926222630.38678-2-andriy.gelman@gmail.com
State Accepted
Commit 0d156eb58a2bfb136c6481611fad7505b3a2c0c1
Headers show
Series [FFmpeg-devel,1/2] avformat/rtspdec: add newline in log message | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andriy Gelman Sept. 26, 2020, 10:26 p.m. UTC
From: Andriy Gelman <andriy.gelman@gmail.com>

There is one general rtsp connection plus two connections per stream (rtp/rtcp).

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
---
 libavformat/rtsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhao Zhili Sept. 27, 2020, 1:38 p.m. UTC | #1
> On Sep 27, 2020, at 6:26 AM, Andriy Gelman <andriy.gelman@gmail.com> wrote:
> 
> From: Andriy Gelman <andriy.gelman@gmail.com>
> 
> There is one general rtsp connection plus two connections per stream (rtp/rtcp).
> 
> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
> ---
> libavformat/rtsp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 5d8491b74b..90f912feb9 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1994,7 +1994,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
>     int *fds = NULL, fdsnum, fdsidx;
> 
>     if (!p) {
> -        p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd));
> +        p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(struct pollfd));

LGTM. I’m not sure is it appropriate to modify sizeof(struct pollfd) to sizeof(*p) in this patch.

>         if (!p)
>             return AVERROR(ENOMEM);
> 
> -- 
> 2.27.0
> 
> _______________________________________________
> 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".
Andriy Gelman Oct. 2, 2020, 12:28 a.m. UTC | #2
On Sun, 27. Sep 21:38, "zhilizhao(赵志立)" wrote:
> 
> 
> > On Sep 27, 2020, at 6:26 AM, Andriy Gelman <andriy.gelman@gmail.com> wrote:
> > 
> > From: Andriy Gelman <andriy.gelman@gmail.com>
> > 
> > There is one general rtsp connection plus two connections per stream (rtp/rtcp).
> > 
> > Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
> > ---
> > libavformat/rtsp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> > index 5d8491b74b..90f912feb9 100644
> > --- a/libavformat/rtsp.c
> > +++ b/libavformat/rtsp.c
> > @@ -1994,7 +1994,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
> >     int *fds = NULL, fdsnum, fdsidx;
> > 
> >     if (!p) {
> > -        p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd));
> > +        p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(struct pollfd));

> 
> LGTM. I’m not sure is it appropriate to modify sizeof(struct pollfd) to sizeof(*p) in this patch.
> 

Zhao, thanks for reviewing.  I'll apply the patch in a couple of days unless
there are more comments.

I was not going make sizeof(*p) change in this particular patch, but someone
correct me if you think otherwise. 

Thanks,
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 5d8491b74b..90f912feb9 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1994,7 +1994,7 @@  static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
     int *fds = NULL, fdsnum, fdsidx;
 
     if (!p) {
-        p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd));
+        p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(struct pollfd));
         if (!p)
             return AVERROR(ENOMEM);