History

avfilter/f_ebur128: Don't allocate outpad names

These names are mostly the same, so not using duplicates saves allocations, checks for the allocations as well as frees.

Andreas Rheinhardt committed 6 years ago

Commit 9b346001 parent 925d2f41 file · +4 −14Browse files

Unified · Split

libavfilter/f_ebur128.c+4−14
@@ -527,30 +527,22 @@ static av_cold int init(AVFilterContext *ctx) · 526 unmodified lines
527 /* insert output pads */527 /* insert output pads */
528 if (ebur128->do_video) {528 if (ebur128->do_video) {
529 pad = (AVFilterPad){529 pad = (AVFilterPad){
530 .name = av_strdup("out0"),530 .name = "out0",
531 .type = AVMEDIA_TYPE_VIDEO,531 .type = AVMEDIA_TYPE_VIDEO,
532 .config_props = config_video_output,532 .config_props = config_video_output,
533 };533 };
534 if (!pad.name)
535 return AVERROR(ENOMEM);
536 ret = ff_insert_outpad(ctx, 0, &pad);534 ret = ff_insert_outpad(ctx, 0, &pad);
537 if (ret < 0) {535 if (ret < 0)
538 av_freep(&pad.name);
539 return ret;536 return ret;
540 }
541 }537 }
542 pad = (AVFilterPad){538 pad = (AVFilterPad){
543 .name = av_asprintf("out%d", ebur128->do_video),539 .name = ebur128->do_video ? "out1" : "out0",
544 .type = AVMEDIA_TYPE_AUDIO,540 .type = AVMEDIA_TYPE_AUDIO,
545 .config_props = config_audio_output,541 .config_props = config_audio_output,
546 };542 };
547 if (!pad.name)
548 return AVERROR(ENOMEM);
549 ret = ff_insert_outpad(ctx, ebur128->do_video, &pad);543 ret = ff_insert_outpad(ctx, ebur128->do_video, &pad);
550 if (ret < 0) {544 if (ret < 0)
551 av_freep(&pad.name);
552 return ret;545 return ret;
553 }
554 546
555 /* summary */547 /* summary */
556 av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter);548 av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter);
@@ -990,8 +982,6 @@ static av_cold void uninit(AVFilterContext *ctx) · 433 unmodified lines
990 av_freep(&ebur128->i400.cache[i]);982 av_freep(&ebur128->i400.cache[i]);
991 av_freep(&ebur128->i3000.cache[i]);983 av_freep(&ebur128->i3000.cache[i]);
992 }984 }
993 for (i = 0; i < ctx->nb_outputs; i++)
994 av_freep(&ctx->output_pads[i].name);
995 av_frame_free(&ebur128->outpicref);985 av_frame_free(&ebur128->outpicref);
996#if CONFIG_SWRESAMPLE986#if CONFIG_SWRESAMPLE
997 av_freep(&ebur128->swr_buf);987 av_freep(&ebur128->swr_buf);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t