Commit graph

128 commits

Author SHA1 Message Date
Edward Hervey 46cc79c43a avviddec: Remove unneeded check
frame is always valid in this function (but wasn't before the
refactoring from a few months ago).

CID #1439540
2018-09-21 16:01:53 +02:00
Mathieu Duponchelle ff3a8f6627 decoders: fix draining
https://bugzilla.gnome.org/show_bug.cgi?id=796900
2018-07-31 19:13:25 +02:00
Seungha Yang db82350245 libav: Fix symbol redefine build error
https://bugzilla.gnome.org/show_bug.cgi?id=796827
2018-07-19 12:21:01 +01:00
Mathieu Duponchelle dd37a553ac av*dec: Ignore decoding errors
We were ignoring these before the port to 4.0, interpreting them
as GST_FLOW_ERROR / GST_ELEMENT_ERROR causes check failures.

We should start using GST_*_DECODER_ERROR in latter commits,
for now simply restore the previous behaviour.
2018-07-13 17:24:07 +02:00
Mathieu Duponchelle be9b6969cb avviddec: fix invalid alignment calculations.
avcodec_align_dimensions2 uses context->pix_fmt to make its
calculations, we thus need to make sure it is adequately set
when calling it.

Fixes:

gst-launch-1.0 videotestsrc ! video/x-raw, width=1920, height=1080 \
! avenc_mpeg4 ! avdec_mpeg4 ! xvimagesink

This showed invalid writes under valgrind, then segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle 965cd81603 avviddec: fix signed/unsigned comparisons
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle d191fb2e50 avvidec: port to new decoding API
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle e4bf6147a0 av_codec_next (deprecated) -> av_codec_iterate
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Nicolas Dufresne d8dfa4657b avviddec: Stop using deperated EDGE API
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne aa724e2f14 Use AV_ namespace for all CODEC_ macro
The remaining use of CODEC_ are codec flags that has been moved into the
new codec private properties or have been deperated. Will be fixed in
later patches.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne 7b3e41e20b Use AV_ namespace for INPUT_BUFFER_PADDING_SIZE
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Edward Hervey 04b3867cb8 libav: Switch to common include 2018-05-11 14:24:03 +02:00
Edward Hervey b894bedeb3 avvidec: Expose Closed Caption as GstVideoCaptionMeta 2018-05-07 17:12:07 +02:00
Mathieu Duponchelle d5b0305241 Enable gif format, and make it so avdemux_gif and avdec_gif can autoplug
https://bugzilla.gnome.org/show_bug.cgi?id=784684
2018-02-12 08:27:53 +01:00
Edward Hervey 79bc255fa2 avvid*: Don't expose V4L2 mem-to-mem decoder and encoders
It's not going to work without special handling. Mask for now.
2018-02-10 15:18:11 +01:00
Sebastian Dröge 5b22802b35 Revert "avviddec: Remove usage of deprecated EDGE APIs"
This reverts commit 4284d791bc.

It causes crashes on various h264 and DNXHD/VC3 streams, where the
decoders write to arbitrary memory far after what we've allocated.
2017-08-10 18:55:29 +03:00
Nicolas Dufresne 4284d791bc avviddec: Remove usage of deprecated EDGE APIs
As a side effect, left/right green bars goes away when using
xvimagesink. I just think that xv cropping is broken, so this is
probably just hiding a bug.
2017-07-11 09:37:03 -04:00
Sebastian Dröge 15a17f3f8d avviddec: Don't expose NVIDIA CUVID decoder
It's not working without further changes on our side, like all hardware
decoders in ffmpeg.
2017-05-16 18:55:36 +03:00
Jan Schmidt 8e6fbe7f63 avviddec: Map any stereo3D info to multiview modes
Map any libav Stereo3D side data to GStreamer multiview
mode / flags for playback.

https://bugzilla.gnome.org/show_bug.cgi?id=767938
2017-03-16 15:23:01 +11:00
Garima Gaur 14dc964f0e Fix some caps leaks when creating pad templates
https://bugzilla.gnome.org/show_bug.cgi?id=776700
2017-01-02 12:41:20 +00:00
leigh123linux@googlemail.com 3c3be3125f avvidenc/dec: Disable more hardware encoder/decoders
Important when using a system ffmpeg/libav.

https://bugzilla.gnome.org/show_bug.cgi?id=774278
2016-11-12 10:33:51 +02:00
Sebastian Dröge 88da0fb956 avviddec: Fix comment to say interlace-mode instead of interlaced-mode 2016-11-04 16:27:59 +02:00
Sebastian Dröge 5e61a8999f avviddec: Use interlaced-mode=interleaved and set field-order if possible
https://bugzilla.gnome.org/show_bug.cgi?id=771376
2016-11-01 20:42:52 +02:00
Sebastian Dröge 5b40fb965b avviddec: Set colorimetry information from the context if known
But only if upstream did not provide that information.

https://bugzilla.gnome.org/show_bug.cgi?id=750882
2016-11-01 20:42:52 +02:00
Sebastian Dröge e3558d4d07 avviddec: Use enum instead of magic numbers for the chroma siting values 2016-09-29 12:01:59 +03:00
Iain Lane f5f32986b6 Only use AV_CODEC_ID_WRAPPED_AVFRAME on new enough libavcodecs
https://bugzilla.gnome.org/show_bug.cgi?id=770753
2016-09-03 14:20:26 +03:00
Edward Hervey 8b374b3f82 avvidec: Ensure skipping strategy gets properly reset
When switching playback modes, like from TRICKMODE or TRICKMODE_KEY_UNITS
back to regular playback, we need to make sure we set the skip mode
back to the default setting.

While this field would be properly reset when we *have* feedback from
downstream (i.e. diff != G_MAXINT64), it would not be reset during
the initial phase (i.e. when the decoder hasn't pushed a buffer yet,
and therefore the sink hasn't sent back QoS information).

This avoids dropping plenty of frames when going back to regular playback
2016-08-04 10:45:14 +02:00
Sebastian Dröge 3e93ad1bcd libav: Ignore more quasi-codecs 2016-07-22 14:54:21 +03:00
Sebastian Dröge 5f4bd291c1 libav: Ignore VAAPI decoders and VAAPI/nvenc encoders
These can show up when having a build against a system version of ffmpeg.
2016-07-22 14:42:59 +03:00
Edward Hervey e36fa30c15 avvidec: Don't set bogus latency
We might have cases where the framerate is not known (0/1).
2016-05-14 12:09:06 +02:00
Edward Hervey 878d32ad38 avvidec: Report the latency once we're fully configured
Several decoders will only be able to report a real latency (has_b_frames)
once they're actually initialized (i.e. when they return their first frame).

Doing it earlier (in set_format) doesn't guarantee that the AVCodecContext
has_b_frames has been properly initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=766362
2016-05-13 09:52:29 +02:00
Tim-Philipp Müller 9e00a37d0e Don't use exported but undeclared core debug category symbols
It's not right and won't work on Windows with MSVC.
2016-02-20 12:59:38 +00:00
Edward Hervey da335a0ea3 avvidec: Bring mpeg video decoders up to PRIMARY rank
We should have done that ages ago ...

https://bugzilla.gnome.org/show_bug.cgi?id=574461
2016-01-21 17:35:51 +01:00
Sebastian Dröge 6e18a221a0 avviddec: Use AVFrame API instead of deprecated AVPicture API 2016-01-20 10:31:40 +02:00
Andreas Cadhalpun 6235a04ef3 libav: Remove usage of deprecated API
https://bugzilla.gnome.org/show_bug.cgi?id=757498
2016-01-16 16:47:40 +02:00
Vineeth TM ae27b9c503 avviddec: remove realvideo slice_offset handling
Handling slice_offset in avviddec is resulting in invalid memory read.
Since rv decoders anyways handle slice_offset, removing the same to fix
memory mishandlings

https://bugzilla.gnome.org/show_bug.cgi?id=758726
2015-12-23 13:17:08 +01:00
Sebastian Dröge 5df8cc5e38 avviddec: Make sure to use a buffer pool with the correct width/height configured on it for pushing buffers downstream
If downstream does not provide a (usable) pool, we would use our internal
pool. But the internal pool might be configured with a different width/height
because of padding, which then will cause problems if we push buffers from it
directly downstream.
Instead create a new pool if the width/height is different.

This prevents crashes with vaapisink and d3dvideosink for example.

Based on the debugging results and discussions with
Nicolas Dufresne <nicolas.dufresne@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=758344
2015-12-01 12:34:27 +02:00
Vineeth T M 839a72f92c avviddec: Fix structure memory leak
gst_structure_copy already takes a reference for config_copy.
No need to take another reference while setting it to buffer pool

https://bugzilla.gnome.org/show_bug.cgi?id=758512
2015-11-23 12:05:26 -03:00
Nicolas Dufresne 2a7aaeb3da avviddec: Don't fallback on allocation failure
Allocation should keep working, falling back causes the stride to
change which is not supported in direct rendering.

https://bugzilla.gnome.org/show_bug.cgi?id=756028
2015-11-07 12:12:46 -05:00
Mark Nauwelaerts 67e55e47e2 avviddec: _drain and _finish need slightly different handling
... since they handle separate cases in video decoder with different requirements.
Consider e.g. x264enc ! rtph264pay ! identity drop-probability=0.1 ! rtph264depay
to illustrate a need for such separation.
2015-10-26 19:54:10 +01:00
Sebastian Dröge dc4b9ef7e6 avviddec: Fix bufferpool config double free by taking a copy as needed
Also free the config in two code paths where we leaked it before.
2015-10-16 18:52:57 +03:00
Luis de Bethencourt 3999a29748 avviddec: only free config when pool doesn't take ownership
Since gst_buffer_pool_set_config() takes ownership of the config structure,
it is only necessary to free the structure before using it when the true
branch of if (gst_buffer_pool_config_validate_params) hasn't run.

gst_buffer_pool_set_config() always takes ownership of the structure
regardless of success or failure. Which means the return, checked with
if (!working_pool), has no relation to the state of the structure.
2015-10-02 11:49:39 +01:00
Luis de Bethencourt 074a128f0f avviddec: fix memory leak
Free config before overwriting.

CID #1320708
2015-09-29 16:44:47 +01:00
Tim-Philipp Müller 6fadf448de avvidec: increase default alignment to 32 bytes
Change default alignment from 16 to 32 bytes, which fixes crashes
when decoding H.265 using AVX2-based decoder code paths and when
using ximagesink/glimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:36:49 +01:00
Tim-Philipp Müller a0ebef9637 avvideodec: ensure required mem alignment fixing avdec_h265 crashes with ximagesink/glimagesink
Make sure the alignment requirement in GstAllocationParams
matches the GstVideoAlignment requirements. This fixes
issues with avdec_h265 crashing in the avx2 code path when
used with playbin and ximagesink/glimagesink as videosink.

The internal video pool would allocate buffers with an
alignment of 15 even though GstVideoAlignment specified
a stride_align requirement of 31 (which comes from ffmpeg).

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:36:30 +01:00
Nicolas Dufresne 6e590fe498 avviddec: Fix pool reallocation logic
Some check where incorect and also unsafe. The only reliable information
in get_buffer2 is the picture width/height really. The side effect is
that the width/height of the internal pool endup padded, so when we
switch we also need to switch to the a new width/height, hence we save
the pool info.

https://bugzilla.gnome.org/show_bug.cgi?id=753869
2015-08-20 16:23:23 -07:00
Nicolas Dufresne e3bdfb5608 aviddec: Re-enable direct rendering
This is achieved by using a tempory internal pool. We can then switch to a
downstream pool if the downstream pool buffer have matching strides.

https://bugzilla.gnome.org/show_bug.cgi?id=752802
2015-08-17 10:47:53 +02:00
Thiago Santos 8cc2e1a76b avviddec: let videodecoder call the default pad query handler
Avoids repeating the same handling in many decoders
2015-08-15 13:51:35 -03:00
Thiago Santos 1a098de5eb avviddec: use template caps intersection for accept-caps
Avoid doing downstream caps queries when accept-caps should just
do a shallow caps check on the element itself

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 09:14:11 -03:00
Olivier Crête c1333df059 avviddec: Remove unused force parameter
This parameter has been always false for a long time.
2015-08-03 21:45:07 -04:00