You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat: Do not search through the AVOption table for a option not in it repeatedly on each packet
This search takes alot of time especially when compared with small packets 46631 decicycles -> 15719 decicycles in read_frame_internal() for amr-nb in 3gp Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -1407,13 +1407,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
av_opt_get_dict_val(s, "metadata", AV_OPT_SEARCH_CHILDREN, &metadata);
|
if (!si->metafree) {
|
||||||
|
int metaret = av_opt_get_dict_val(s, "metadata", AV_OPT_SEARCH_CHILDREN, &metadata);
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
|
s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
|
||||||
av_dict_copy(&s->metadata, metadata, 0);
|
av_dict_copy(&s->metadata, metadata, 0);
|
||||||
av_dict_free(&metadata);
|
av_dict_free(&metadata);
|
||||||
av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
|
av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
|
||||||
}
|
}
|
||||||
|
si->metafree = metaret == AVERROR_OPTION_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->debug & FF_FDEBUG_TS)
|
if (s->debug & FF_FDEBUG_TS)
|
||||||
av_log(s, AV_LOG_DEBUG,
|
av_log(s, AV_LOG_DEBUG,
|
||||||
|
@@ -183,6 +183,11 @@ typedef struct FFFormatContext {
|
|||||||
* Set if chapter ids are strictly monotonic.
|
* Set if chapter ids are strictly monotonic.
|
||||||
*/
|
*/
|
||||||
int chapter_ids_monotonic;
|
int chapter_ids_monotonic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contexts and child contexts do not contain a metadata option
|
||||||
|
*/
|
||||||
|
int metafree;
|
||||||
} FFFormatContext;
|
} FFFormatContext;
|
||||||
|
|
||||||
static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
|
static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
|
||||||
|
Reference in New Issue
Block a user