Commit graph

17 commits

Author SHA1 Message Date
Sebastian Dröge 09cc614bb1 avviddec: Temporarily unlock stream lock while flushing buffers
This can call into the decoder again from other threads and try to take
the stream lock from there, which would cause a deadlock.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2558

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4831>
2023-06-11 16:47:53 +00:00
Sebastian Dröge 6b16b41889 ffmpeg: avauddec/avviddec: Free packet side data after usage
As we don't use proper refcounting with AVPacket we have to manage this
ourselves.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2006

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4079>
2023-02-28 13:51:12 +00:00
Sebastian Dröge e42752f42e avviddec: Disable AV1 decoder
We have various elements for AV1 decoding, the ffmpeg one only works if
hardware support is available and seems to require special signalling.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4019>
2023-02-21 18:33:18 +00:00
U. Artie Eoff 6d55206e77 avviddec: change AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
This fixes a compile error with recent upstream FFmpeg.

The AV_CODEC_CAP_AUTO_THREADS was deprecated and renamed to
AV_CODEC_CAP_OTHER_THREADS in FFmpeg upstream commit
7d09579190de (lavc 58.132.100).

The AV_CODEC_CAP_AUTO_THREADS was finally removed in FFmpeg upstream
commit 10c9a0874cb3 (lavc 59.63.100).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3965>
2023-02-15 01:15:45 +00:00
Sebastian Dröge a70935782e avvidenc: Don't take ffmpeg timestamps verbatim but only use them to calculate DTS
The ffmpeg timestamps are inaccurate and only in framerate granularity.
To avoid generating inaccurate output timestamps, especially with
variable framerate streams, only use the ffmpeg timestamps for
calculating the DTS.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1544
again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3791>
2023-01-26 01:28:23 +00:00
Sebastian Dröge ceecd4717d Revert "avvidenc: Set timebase in the ffmpeg context to nanoseconds and set framerate"
This reverts commit 50db59449e.

This broke the MPEG-1 video encoder as it requires the framerate to be
used for the timebase.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1734

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3791>
2023-01-26 01:28:23 +00:00
Sebastian Dröge 2c503a8d7d avvidenc: Offset PTS to zero to fix bitrate control
Otherwise ffmpeg's rate control algorithm will not work correctly as
it is based on the absolute PTS values.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-libav/-/issues/91

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3727>
2023-01-13 20:28:09 +00:00
Sebastian Dröge 49dccf42b6 avvidenc: Set timebase in the ffmpeg context to nanoseconds and set framerate
As we now actually use the timestamps from ffmpeg for timestamping the
output we would lose a lot of accuracy if the framerate is used.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1544

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3679>
2023-01-04 17:19:37 +00:00
Nicolas Dufresne c29bfbe448 avdec_h265: Fix endless renegoation with alternate interlacing
The picture parameter picture->top_field_first is reused in this mode
to signal the TOP fields. As a side effect, it will change every frame
and current code assumed that if this changes then a renegotiation is
needed. Fixed this by ignoring that change whenever we are decoding one field
only.

Fixes #1523

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3289>
2022-10-27 18:02:54 +01:00
Nicolas Dufresne 7071c4ec2f avviddec: Avoid flushing on framerate changes
A framerate change does not require flushing the decoder and causes
issues with some specific fragmented files if the two fragments have
different framerate.

Fixes #1522

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3280>
2022-10-27 01:32:05 +01:00
Mathieu Duponchelle 397c4c3392 avauddec: address regression with WMA files ..
By outputting lead-in samples that FFmpeg now would like us to ignore,
and discarding trailing samples that it would now like us to output.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1474

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1348
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3125>
2022-10-07 16:31:09 +00:00
Tim-Philipp Müller 67245861a2 avauddec: fix unnecessary reconfiguration if the audio layout isn't specified
It would constantly want to renegotiate (and spam the debug log) even
though the channel layout hasn't actually changed. We use the same
fallback in gst_ffmpegauddec_negotiate() already.

This happens with WMA files for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3105>
2022-10-01 11:39:00 +01:00
Seungha Yang 1ae1faeb2d libav: Fix for APNG encoder property registration
The AVClass name of Animated PNG in FFmpeg 5.x is "(A)PNG"
and it will be converted to "-a-png" through
g_ascii_strdown() and g_strcanon(). But GLib disallow leading '-'
character for a GType name. Strip leading '-' to workaround it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2733>
2022-07-08 15:41:09 +01:00
Guillaume Desmottes 7aa763cab7 libav: fix frame leak on negotiation error
The function owns a reference on the frame. Drop it if negotiation
failed as we are already doing for the other error cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2217>
2022-04-18 10:50:35 +01:00
Edward Hervey 530272850d avviddec: Remove vc1/wmv3 override
FFMPEG 5+ doesn't allow overriding the codec anymore (causes a segfault if you
attempt to do that). But the best part is ... that with the current caps
implementation in pad template and gst_ffmpeg_caps_to_codecid() we would never
replace it by anything different than the existing codec id.

Fixes #1054

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2074>
2022-03-30 17:36:06 +01:00
Xi Ruoyao 6ea56e7fd3 gst-libav: fix build with ffmpeg-5.0.0
Latest ffmpeg has removed avcodec_get_context_defaults(), and its
documentation says a new AVCodecContext should be allocated for this
purpose.  The pointer returned by avcodec_find_decoder() is now
const-qualified so we also need to adjust for it.  And, AVCOL_RANGE_MPEG
is now rejected with strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1531>
2022-01-17 18:11:32 +08:00
Thibault Saunier 7a371e75b7 Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00