mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
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
This commit is contained in:
parent
8e8b8a8d34
commit
d71e03b3be
1 changed files with 19 additions and 17 deletions
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue