Skip to content

Commit

Permalink
lavfi: let gcc realign the stack on public graph driving functions
Browse files Browse the repository at this point in the history
The functions which actually drive the filter graph by pushing
frames through it need to ensure an aligned stack for SIMD functions.

This fixes a crash in YADIF filter when using a mingw build in a MSVC
application.

Signed-off-by: Martin Storsjö <martin@martin.st>
  • Loading branch information
Nevcairiel authored and mstorsjo committed May 4, 2013
1 parent c0c2b96 commit 20c8657
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions libavfilter/buffersink.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
return 0;
}

int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame)
int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx,
AVFrame *frame)
{
BufferSinkContext *s = ctx->priv;
AVFilterLink *link = ctx->inputs[0];
Expand Down Expand Up @@ -98,7 +99,8 @@ static int read_from_fifo(AVFilterContext *ctx, AVFrame *frame,

}

int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples)
int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx,
AVFrame *frame, int nb_samples)
{
BufferSinkContext *s = ctx->priv;
AVFilterLink *link = ctx->inputs[0];
Expand Down Expand Up @@ -144,7 +146,8 @@ static void compat_free_buffer(AVFilterBuffer *buf)
av_free(buf);
}

static int compat_read(AVFilterContext *ctx, AVFilterBufferRef **pbuf, int nb_samples)
static int attribute_align_arg compat_read(AVFilterContext *ctx,
AVFilterBufferRef **pbuf, int nb_samples)
{
AVFilterBufferRef *buf;
AVFrame *frame;
Expand Down
3 changes: 2 additions & 1 deletion libavfilter/buffersrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
return ret;
}

int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx,
AVFrame *frame)
{
BufferSourceContext *s = ctx->priv;
AVFrame *copy;
Expand Down

0 comments on commit 20c8657

Please sign in to comment.