diff options
author | Zebediah Figura <z.figura12@gmail.com> | 2020-10-21 14:55:40 -0500 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-10-22 08:05:20 +0000 |
commit | e999318fd7f6384fed9962597b326ec77ebf452d (patch) | |
tree | a6c9a4240104b7d43b1acf8c952be215ce26abb8 | |
parent | c9d15fec7e5bc6c0eb2d736f467318c4fcacb17e (diff) |
theoradec: Set telemetry options only if they are nonzero
Setting telemetry options, even to zero, causes libtheora to enable an expensive code path. For large enough videos (e.g. 1920x1080) this can increase the time to decode each frame by 30-40 ms, which can be enough to cause noticeable stutter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/887>
-rw-r--r-- | ext/theora/gsttheoradec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 862aa1698..e76374a23 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -471,19 +471,23 @@ theora_handle_type_packet (GstTheoraDec * dec) /* done */ dec->decoder = th_decode_alloc (&dec->info, dec->setup); - if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MV, + if (dec->telemetry_mv && + th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MV, &dec->telemetry_mv, sizeof (dec->telemetry_mv)) != TH_EIMPL) { GST_WARNING_OBJECT (dec, "Could not enable MV visualisation"); } - if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MBMODE, + if (dec->telemetry_mbmode && + th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_MBMODE, &dec->telemetry_mbmode, sizeof (dec->telemetry_mbmode)) != TH_EIMPL) { GST_WARNING_OBJECT (dec, "Could not enable MB mode visualisation"); } - if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_QI, + if (dec->telemetry_qi && + th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_QI, &dec->telemetry_qi, sizeof (dec->telemetry_qi)) != TH_EIMPL) { GST_WARNING_OBJECT (dec, "Could not enable QI mode visualisation"); } - if (th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_BITS, + if (dec->telemetry_bits && + th_decode_ctl (dec->decoder, TH_DECCTL_SET_TELEMETRY_BITS, &dec->telemetry_bits, sizeof (dec->telemetry_bits)) != TH_EIMPL) { GST_WARNING_OBJECT (dec, "Could not enable BITS mode visualisation"); } |