mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
baseparse: localize use of provided fps information
This commit is contained in:
parent
5dd8a489d5
commit
1f7359d388
1 changed files with 5 additions and 15 deletions
|
@ -943,14 +943,8 @@ gst_base_parse_convert_default (GstBaseParse * parse,
|
||||||
if (!parse->priv->framecount)
|
if (!parse->priv->framecount)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* either frame info (having num means den also ok) or use average bitrate */
|
|
||||||
if (parse->priv->fps_num) {
|
|
||||||
duration = parse->priv->framecount * parse->priv->fps_den * 1000;
|
|
||||||
bytes = parse->priv->bytecount * parse->priv->fps_num;
|
|
||||||
} else {
|
|
||||||
duration = parse->priv->acc_duration / GST_MSECOND;
|
duration = parse->priv->acc_duration / GST_MSECOND;
|
||||||
bytes = parse->priv->bytecount;
|
bytes = parse->priv->bytecount;
|
||||||
}
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!duration || !bytes))
|
if (G_UNLIKELY (!duration || !bytes))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1076,13 +1070,9 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBuffer * buffer)
|
||||||
data_len = GST_BUFFER_SIZE (buffer) - overhead;
|
data_len = GST_BUFFER_SIZE (buffer) - overhead;
|
||||||
parse->priv->data_bytecount += data_len;
|
parse->priv->data_bytecount += data_len;
|
||||||
|
|
||||||
if (parse->priv->fps_num) {
|
/* duration should be valid by now,
|
||||||
/* Calculate duration of a frame from frame properties */
|
* either set by subclass or maybe based on fps settings */
|
||||||
frame_dur = (GST_SECOND * parse->priv->fps_den) / parse->priv->fps_num;
|
if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
|
||||||
parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) /
|
|
||||||
(parse->priv->framecount * frame_dur);
|
|
||||||
|
|
||||||
} else if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
|
|
||||||
/* Calculate duration of a frame from buffer properties */
|
/* Calculate duration of a frame from buffer properties */
|
||||||
frame_dur = GST_BUFFER_DURATION (buffer);
|
frame_dur = GST_BUFFER_DURATION (buffer);
|
||||||
parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) /
|
parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) /
|
||||||
|
|
Loading…
Reference in a new issue