From: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc: Fix path handling for Windows Date: Sat, 14 Jun 2025 00:56:58 +0000 Message-ID: <DM8P223MB0365AC255CA600AF03917902BA76A@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw) In-Reply-To: <9199955b-d517-2a9b-fd2b-ddda1833493c@passwd.hu> > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of > Marton Balint > Sent: Freitag, 13. Juni 2025 23:36 > To: FFmpeg development discussions and patches <ffmpeg- > devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc: Fix path > handling for Windows > > > > On Fri, 13 Jun 2025, softworkz wrote: > > > From: softworkz <softworkz@hotmail.com> > > > > Can you give an example where the path handling is wrong and where > this > patch fixes it? Is there a trac ticket? > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > --- > > libavformat/hlsenc.c | 43 ++++++++++++++++++++++++++++----------- > ---- > > 1 file changed, 28 insertions(+), 15 deletions(-) > > +{ > > + if (!path || *path == '\0') > > + return -1; > > + > > + char *p = strrchr(path, '/'); > > +#if HAVE_DOS_PATHS > > + char *q = strrchr(path, '\\'); > > + p = FFMAX(p, q); > > You are comparing potentially NULL pointers here. Hi Marton, actually, there's a prequel to this patch, a simple form of which I had submitted in 2022 and ended up in a discussion with Andreas: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2022-January/291657.html Obviously, this wasn't about performance-critical code in any way, but as Andreas had insisted so much on it at that time, and there was also topic about null-pointer comparison, I actually wanted to go a very different route this time. Looking at av_basename() (when HAVE_DOS_PATHS is enabled), it seemed to be easy to beat the tripled search by doing a single (reverse) search for all three chars. So I created a function av_strrcspn(). The naming should be correct, while there's no strrcspn function in reality. I tried various optimizations but I wasn't able to beta the triple strrchar(). Code and benchmark are here, in case anybody is interested: https://github.com/FFmpeg/FFmpeg/compare/master...softworkz:FFmpeg:test_av_strrcspn I suspect that there's some parallelism/SIMD in strrchar() which makes it faster than expected. Finally, I ditched that way and resorted to doing the same/similar like in av_basename(). Now, either both a wrong or both are right... Best regards, sw _______________________________________________ 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".
next prev parent reply other threads:[~2025-06-14 0:57 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-06-13 17:19 [FFmpeg-devel] [PATCH 0/3] avformat/hlsenc: Some HLS improvements ffmpegagent 2025-06-13 17:19 ` [FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: Log information about segments written softworkz 2025-06-13 21:02 ` Marton Balint 2025-06-13 23:31 ` softworkz . 2025-06-13 17:19 ` [FFmpeg-devel] [PATCH 2/3] avformat/hlsenc: Log InitFileComplete message softworkz 2025-06-13 17:19 ` [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc: Fix path handling for Windows softworkz 2025-06-13 21:36 ` Marton Balint 2025-06-13 23:34 ` softworkz . 2025-06-14 15:34 ` Marton Balint 2025-06-14 0:56 ` softworkz . [this message] 2025-06-14 0:12 ` [FFmpeg-devel] [PATCH v2] " softworkz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DM8P223MB0365AC255CA600AF03917902BA76A@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM \ --to=softworkz-at-hotmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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