Commit d71e03b3 authored by Jan Alexander Steffens's avatar Jan Alexander Steffens Committed by Sebastian Dröge

baseparse: Don't add calculated bitrates until threshold

Waiting before posting calculated bitrates seems to be the
intent of the code, so avoid adding them to the tag list
pushed with the first frame.

When the threshold is reached, gst_base_parse_update_bitrates
sets tags_changed, so this posts the calculated ones right
that moment.

This prevents an insane average calculated from just the
first (key) frame from getting posted.

https://bugzilla.gnome.org/show_bug.cgi?id=768439
parent 8e8b8a8d
......@@ -952,23 +952,25 @@ gst_base_parse_queue_tag_event_update (GstBaseParse * parse)
return;
}
/* only add bitrate tags to non-empty taglists for now, and only if neither
* upstream tags nor the subclass sets the bitrate tag in question already */
if (parse->priv->min_bitrate != G_MAXUINT && parse->priv->post_min_bitrate) {
GST_LOG_OBJECT (parse, "adding min bitrate %u", parse->priv->min_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP, GST_TAG_MINIMUM_BITRATE,
parse->priv->min_bitrate, NULL);
}
if (parse->priv->max_bitrate != 0 && parse->priv->post_max_bitrate) {
GST_LOG_OBJECT (parse, "adding max bitrate %u", parse->priv->max_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP, GST_TAG_MAXIMUM_BITRATE,
parse->priv->max_bitrate, NULL);
}
if (parse->priv->avg_bitrate != 0 && parse->priv->post_avg_bitrate) {
parse->priv->posted_avg_bitrate = parse->priv->avg_bitrate;
GST_LOG_OBJECT (parse, "adding avg bitrate %u", parse->priv->avg_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP, GST_TAG_BITRATE,
parse->priv->avg_bitrate, NULL);
if (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE) {
/* only add bitrate tags to non-empty taglists for now, and only if neither
* upstream tags nor the subclass sets the bitrate tag in question already */
if (parse->priv->min_bitrate != G_MAXUINT && parse->priv->post_min_bitrate) {
GST_LOG_OBJECT (parse, "adding min bitrate %u", parse->priv->min_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP,
GST_TAG_MINIMUM_BITRATE, parse->priv->min_bitrate, NULL);
}
if (parse->priv->max_bitrate != 0 && parse->priv->post_max_bitrate) {
GST_LOG_OBJECT (parse, "adding max bitrate %u", parse->priv->max_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP,
GST_TAG_MAXIMUM_BITRATE, parse->priv->max_bitrate, NULL);
}
if (parse->priv->avg_bitrate != 0 && parse->priv->post_avg_bitrate) {
parse->priv->posted_avg_bitrate = parse->priv->avg_bitrate;
GST_LOG_OBJECT (parse, "adding avg bitrate %u", parse->priv->avg_bitrate);
gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP,
GST_TAG_BITRATE, parse->priv->avg_bitrate, NULL);
}
}
parse->priv->pending_events =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment