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
527527 /* insert output pads */
528528 if (ebur128->do_video) {
529529 pad = (AVFilterPad){
530− .name = av_strdup("out0"),
530+ .name = "out0",
531531 .type = AVMEDIA_TYPE_VIDEO,
532532 .config_props = config_video_output,
533533 };
534− if (!pad.name)
535− return AVERROR(ENOMEM);
536534 ret = ff_insert_outpad(ctx, 0, &pad);
537− if (ret < 0) {
538− av_freep(&pad.name);
535+ if (ret < 0)
539536 return ret;
540− }
541537 }
542538 pad = (AVFilterPad){
543− .name = av_asprintf("out%d", ebur128->do_video),
539+ .name = ebur128->do_video ? "out1" : "out0",
544540 .type = AVMEDIA_TYPE_AUDIO,
545541 .config_props = config_audio_output,
546542 };
547− if (!pad.name)
548− return AVERROR(ENOMEM);
549543 ret = ff_insert_outpad(ctx, ebur128->do_video, &pad);
550− if (ret < 0) {
551− av_freep(&pad.name);
544+ if (ret < 0)
552545 return ret;
553− }
554546
555547 /* summary */
556548 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
990982 av_freep(&ebur128->i400.cache[i]);
991983 av_freep(&ebur128->i3000.cache[i]);
992984 }
993− for (i = 0; i < ctx->nb_outputs; i++)
994− av_freep(&ctx->output_pads[i].name);
995985 av_frame_free(&ebur128->outpicref);
996986 #if CONFIG_SWRESAMPLE
997987 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