On Wed, 18 Dec 2013 20:58:32 -0500, Stephen Hutchinson <[email protected]> wrote:
> This allows scripts that serve both video and audio to actually
> have audio served out without encountering errors.
> 
> Otherwise, video-only scripts work and audio-only scripts work,
> but scripts that have both will only output a video stream - the
> audio stream is marked as being there, but it's empty.
> ---
>  libavformat/avisynth.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
> index 10a0740..040b90d 100644
> --- a/libavformat/avisynth.c
> +++ b/libavformat/avisynth.c
> @@ -570,7 +570,10 @@ static int avisynth_read_packet_audio(AVFormatContext 
> *s, AVPacket *pkt,
>      if (!pkt->size)
>          return AVERROR_UNKNOWN;
>  
> -    if (av_new_packet(pkt, pkt->size) < 0)
> +    /* This ensures scripts that serve both video and audio
> +     * have audio output */
> +    pkt->data = av_malloc(pkt->size);
> +    if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0)
>          return AVERROR(ENOMEM);
>  

No, this is not correct.

If I understand the problem properly, then stream_index gets overwritten by
av_new_packet(). The proper solution is then to set stream_index after calling
av_new_packet().

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to