From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 7364241179 for ; Sat, 16 Apr 2022 20:06:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE46968B278; Sat, 16 Apr 2022 23:06:53 +0300 (EEST) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61E2968B120 for ; Sat, 16 Apr 2022 23:06:46 +0300 (EEST) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 23GK6iZ1022730-23GK6iZ2022730; Sat, 16 Apr 2022 23:06:44 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id 76E2DA1431; Sat, 16 Apr 2022 23:06:44 +0300 (EEST) Date: Sat, 16 Apr 2022 23:06:43 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <20220415115301.973416-1-tmatth@videolan.org> Message-ID: References: <20220415115301.973416-1-tmatth@videolan.org> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH 1/1] librtmp: use AVBPrint instead of char * X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Tristan Matthews Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 15 Apr 2022, Tristan Matthews wrote: > This avoids having to do one pass to calculate the full length to allocate > followed by a second pass to actually append values. > --- > libavformat/librtmp.c | 124 +++++++++++------------------------------- > 1 file changed, 33 insertions(+), 91 deletions(-) > > diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c > index 43013e46e0..b7e9fc81cf 100644 > --- a/libavformat/librtmp.c > +++ b/libavformat/librtmp.c > @@ -25,6 +25,7 @@ > */ > > #include "libavutil/avstring.h" > +#include "libavutil/bprint.h" > #include "libavutil/mathematics.h" > #include "libavutil/opt.h" > #include "avformat.h" > @@ -38,6 +39,7 @@ > > typedef struct LibRTMPContext { > const AVClass *class; > + AVBPrint filename; > RTMP rtmp; > char *app; > char *conn; > @@ -50,7 +52,6 @@ typedef struct LibRTMPContext { > char *pageurl; > char *client_buffer_time; > int live; > - char *temp_filename; > int buffer_size; > } LibRTMPContext; This looks ok to me. (I guess it also could be considered viable to not store the AVBprint in the context but detach an allocated string instead; that would decrease the persistent allocation size a little, at the cost of some more copying, but the difference is probably negligible, so this probably is sensible as is.) Let's still wait for Marton's review too. // Martin _______________________________________________ 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".