[FFmpeg-devel] [PATCH] Implement NewTek NDI support
Maksym Veremeyenko
verem at m1stereo.tv
Fri Aug 18 18:56:46 EEST 2017
On 14.08.2017 0:00, Marton Balint wrote:
[...]
>> + ret = av_new_packet(pkt, v->yres * v->line_stride_in_bytes);
>> + if (ret < 0)
>> + return ret;
>
> You are leaking the NDI video frame here on error. Maybe better to put
> NDIlib_recv_free_video into the parent function.
>
done
[...]
>> + ret = av_new_packet(pkt, 2 * a->no_samples * a->no_channels);
>> + if (ret < 0)
>> + return ret;
>
> Similar to the previous case, you are leaking the NDI audio frame here
> on error. Maybe better to put NDIlib_recv_free_audio into the parent
> function.
>
done
[...]
>> + if (NDIlib_FourCC_type_UYVY == v->FourCC ||
>> NDIlib_FourCC_type_UYVA == v->FourCC) {
>
> You should give the user a warning here in case of UYVA format, because
> you are
> going to skip the alpha channel.
>
done
[...]
>> + t = NDIlib_recv_capture(ctx->recv, &v, &a, &m, 40);
>> +
>> + if (NDIlib_frame_type_video == t) {
>> + if (!ctx->video_st) {
>> + ret = ndi_create_video_stream(avctx, &v);
>> + if (ret < 0)
>> + return ret;
>
> You are leaking the video frame here on error.
>
>> + }
>> + ret = ndi_set_video_packet(avctx, &v, pkt);
>> + break;
>> + }
>> + else if (NDIlib_frame_type_audio == t) {
>> + if (!ctx->audio_st) {
>> + ret = ndi_create_audio_stream(avctx, &a);
>> + if (ret < 0)
>> + return ret;
>
> You are leaking the audio frame here on error.
>
done
>> + if (ctx->last_avframe)
>> + av_frame_free(&ctx->last_avframe);
>
> You might spare the 'if' here, av_frame_free handles the NULL pointer as
> well.
>
>> + }
>> +
>> + if (ctx->video)
>> + av_freep(&ctx->video);
>
> Same here.
>
>> +
>> + if (ctx->audio)
>> + av_freep(&ctx->audio);
>
> And here.
>
done
--
Maksym Veremeyenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavd-implement-NewTek-NDI-input-output-device-suppor_W0.patch
Type: text/x-patch
Size: 33801 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170818/32a07ff3/attachment.bin>
More information about the ffmpeg-devel
mailing list