> > @@ -524,17 +522,22 @@ static int movie_push_frame(AVFilterContext *ctx, > > unsigned out_id) > > return AVERROR(ENOMEM); > > > > frame_type = st->st->codecpar->codec_type; > > - switch (frame_type) { > > - case AVMEDIA_TYPE_VIDEO: > > - ret = avcodec_decode_video2(st->codec_ctx, frame, &got_frame, pkt); > > - break; > > - case AVMEDIA_TYPE_AUDIO: > > - ret = avcodec_decode_audio4(st->codec_ctx, frame, &got_frame, pkt); > > - break; > > - default: > > + if (frame_type == AVMEDIA_TYPE_VIDEO || frame_type == > > AVMEDIA_TYPE_AUDIO) { > > > + ret = avcodec_send_packet(st->codec_ctx, pkt); > > + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { > > + ret = 0; > > + } > > + if (ret >= 0) { > > + ret = avcodec_receive_frame(st->codec_ctx, frame); > > This is doing one avcodec_receive_frame() for each > avcodec_send_packet(): this is not how the new API is supposed to be > used. If it was, there would not have been the need for a new API in the > first place, would it? >
Its indeed not ideal, and instead it should loop over receive_frame until EAGAIN is returned. Otherwise you might lose frames when send_packet doesnt actually accept a new one yet. Additionally, the patch could still use quite some cleanup in the AVPacket handling, since the new API will always consume a full AVPacket, and any manual handling of partial packets is no longer required, so this all can be removed as well further down in that function. - Hendrik _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".