* [FFmpeg-devel] [PATCH] avfilter/src_movie: stop using AVPacket on stack
@ 2023-05-20 2:40 James Almer
2023-05-20 9:41 ` Paul B Mahol
0 siblings, 1 reply; 5+ messages in thread
From: James Almer @ 2023-05-20 2:40 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavfilter/src_movie.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 5937613d13..b55c2bcb6e 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -72,6 +72,7 @@ typedef struct MovieContext {
int dec_threads;
AVFormatContext *format_ctx;
+ AVPacket *pkt;
int max_stream_index; /**< max stream # actually used for output */
MovieStream *st; /**< array of all streams, one per output */
@@ -279,6 +280,10 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
for (i = 0; i < movie->format_ctx->nb_streams; i++)
movie->format_ctx->streams[i]->discard = AVDISCARD_ALL;
+ movie->pkt = av_packet_alloc();
+ if (!movie->pkt)
+ return AVERROR(ENOMEM);
+
movie->st = av_calloc(nb_streams, sizeof(*movie->st));
if (!movie->st)
return AVERROR(ENOMEM);
@@ -348,6 +353,7 @@ static av_cold void movie_uninit(AVFilterContext *ctx)
av_freep(&movie->out_index);
if (movie->format_ctx)
avformat_close_input(&movie->format_ctx);
+ av_packet_free(&movie->pkt);
}
static int movie_query_formats(AVFilterContext *ctx)
@@ -459,11 +465,11 @@ static int rewind_file(AVFilterContext *ctx)
static int movie_decode_packet(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
- AVPacket pkt = { 0 };
+ AVPacket *pkt = movie->pkt;
int pkt_out_id, ret;
/* read a new packet from input stream */
- ret = av_read_frame(movie->format_ctx, &pkt);
+ ret = av_read_frame(movie->format_ctx, pkt);
if (ret == AVERROR_EOF) {
/* EOF -> set all decoders for flushing */
for (int i = 0; i < ctx->nb_outputs; i++) {
@@ -477,11 +483,11 @@ static int movie_decode_packet(AVFilterContext *ctx)
return ret;
/* send the packet to its decoder, if any */
- pkt_out_id = pkt.stream_index > movie->max_stream_index ? -1 :
- movie->out_index[pkt.stream_index];
+ pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 :
+ movie->out_index[pkt->stream_index];
if (pkt_out_id >= 0)
- ret = avcodec_send_packet(movie->st[pkt_out_id].codec_ctx, &pkt);
- av_packet_unref(&pkt);
+ ret = avcodec_send_packet(movie->st[pkt_out_id].codec_ctx, pkt);
+ av_packet_unref(pkt);
return ret;
}
--
2.40.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] avfilter/src_movie: stop using AVPacket on stack
2023-05-20 2:40 [FFmpeg-devel] [PATCH] avfilter/src_movie: stop using AVPacket on stack James Almer
@ 2023-05-20 9:41 ` Paul B Mahol
2023-05-20 11:18 ` James Almer
0 siblings, 1 reply; 5+ messages in thread
From: Paul B Mahol @ 2023-05-20 9:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Why you doing this to me?
I already did this in my patch, that you ignored.
_______________________________________________
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] avfilter/src_movie: stop using AVPacket on stack
2023-05-20 9:41 ` Paul B Mahol
@ 2023-05-20 11:18 ` James Almer
2023-05-20 11:43 ` Paul B Mahol
0 siblings, 1 reply; 5+ messages in thread
From: James Almer @ 2023-05-20 11:18 UTC (permalink / raw)
To: ffmpeg-devel
On 5/20/2023 6:41 AM, Paul B Mahol wrote:
> Why you doing this to me?
> I already did this in my patch, that you ignored.
You did it in the activate patch, that i did not look at because i could
not review it, sorry.
Patch dropped then.
_______________________________________________
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] avfilter/src_movie: stop using AVPacket on stack
2023-05-20 11:18 ` James Almer
@ 2023-05-20 11:43 ` Paul B Mahol
2023-05-20 12:00 ` James Almer
0 siblings, 1 reply; 5+ messages in thread
From: Paul B Mahol @ 2023-05-20 11:43 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 5/20/23, James Almer <jamrial@gmail.com> wrote:
> On 5/20/2023 6:41 AM, Paul B Mahol wrote:
>> Why you doing this to me?
>> I already did this in my patch, that you ignored.
>
> You did it in the activate patch, that i did not look at because i could
> not review it, sorry.
>
> Patch dropped then.
I can push this your patch, and just rebase mine, if you prefer that approach.
> _______________________________________________
> 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".
>
_______________________________________________
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] avfilter/src_movie: stop using AVPacket on stack
2023-05-20 11:43 ` Paul B Mahol
@ 2023-05-20 12:00 ` James Almer
0 siblings, 0 replies; 5+ messages in thread
From: James Almer @ 2023-05-20 12:00 UTC (permalink / raw)
To: ffmpeg-devel
On 5/20/2023 8:43 AM, Paul B Mahol wrote:
> On 5/20/23, James Almer <jamrial@gmail.com> wrote:
>> On 5/20/2023 6:41 AM, Paul B Mahol wrote:
>>> Why you doing this to me?
>>> I already did this in my patch, that you ignored.
>>
>> You did it in the activate patch, that i did not look at because i could
>> not review it, sorry.
>>
>> Patch dropped then.
>
> I can push this your patch, and just rebase mine, if you prefer that approach.
No, your set predates this, so just push your activate patch with these
changes whenever is ready.
_______________________________________________
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:[~2023-05-20 12:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20 2:40 [FFmpeg-devel] [PATCH] avfilter/src_movie: stop using AVPacket on stack James Almer
2023-05-20 9:41 ` Paul B Mahol
2023-05-20 11:18 ` James Almer
2023-05-20 11:43 ` Paul B Mahol
2023-05-20 12:00 ` James Almer
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