Commit graph

259 commits

Author SHA1 Message Date
Sebastian Dröge
eedefc9f6b avcodecmap: Don't allocate dummy codec data anymore, it causes crashes nowadays
Multithreaded encoders are going to free this dummy codec data twice, e.g.
with this pipeline
  gst-launch-1.0 videotestsrc num-buffers=40 ! \
    videoconvert ! avenc_mjpeg ! fakesink
2015-10-03 18:25:35 +01:00
Sebastian Dröge
e5e78379ad avvidenc: Pass the correct user_data to gst_buffer_new_wrapped_full()
Fixes crash with e.g.

  gst-launch-1.0 videotestsrc num-buffers=40 ! \
    videoconvert ! avenc_huffyuv ! fakesink
2015-10-03 18:14:05 +01:00
Sebastian Dröge
fcdb9c08c5 libav: G_CONST_RETURN is deprecated since GLib 2.30 2015-10-02 23:02:01 +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
Jan Schmidt
30a406591a avvid/audenc: Set some tags in the output for downstream's info
Add the codec name and bitrate into the output for informational
purposes. Bitrate in particular is now used by flvmux to set
videodatarate and audiodatarate in the resulting stream
2015-08-24 00:01:40 +10: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
fa29036836 avvidenc: use template subset check for accept-caps
It is faster than doing a query that propagates downstream and
should be enough
2015-08-17 04:36:39 -03:00
Thiago Santos
ad215706ec avaudenc: use pad template caps for accept-caps
use template subset check for accept-caps

It is faster than doing a query that propagates downstream and
should be enough
2015-08-17 04:35:41 -03:00
Thiago Santos
15ef18c3e1 avaudenc: remove useless getcaps method
It just calls the exact same function as the default handler
2015-08-16 14:14:27 -03:00
Thiago Santos
427db7f484 avvidenc: remove useless getcaps method
It just calls the exact same function as the default handler
2015-08-16 14:13:05 -03:00
Thiago Santos
5c56635e97 avauddec: let audiodecoder call the default pad query handler
Avoids repeating the same handling in many decoders
2015-08-15 13:51:35 -03: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
Thiago Santos
2b387ba827 avauddec: 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
Jan Schmidt
51896af52b Map ffmpeg metadata to GStreamer tags
Update to the metadata API ffmpeg has had in
place for a long time now, and reenable output
of GStreamer tags from the demuxer.

https://bugzilla.gnome.org/show_bug.cgi?id=566605
2015-08-05 16:53:28 -04: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
Olivier Crête
1c70fb229a avviddec: Use caps-like size in get_buffer2()
The size in the AVFrame in get_buffer2 don't match the output size,
instead they match ffmpeg's memory requirements, so we can't compare
them from the values of the output AVFrame. Those are comparable to
the values in the passed AVCodecContext.
2015-08-03 21:40:12 -04:00
Olivier Crête
e7ece560d6 avviddec: Reset current_dr on close and when not chosing it
https://bugzilla.gnome.org/show_bug.cgi?id=753189
2015-08-03 21:03:05 -04:00
Olivier Crête
0a0ee42752 avviddec: Disable direct rendering before a frame has been produces
ffmpeg doesn't provide the final's image width & height in the get_buffer2()
callback, so it's not possible to create an output state for GstVideoDecoder
at this stage. So only try to do direct rendering if the buffer pool has already
been negotiated based on the final decoded size.

This partially reverts the effects of 2e621f8db

https://bugzilla.gnome.org/show_bug.cgi?id=752802
2015-07-28 16:16:10 -04:00
Olivier Crête
1a127d19bb avviddec: Get code out of loop
Code was executed only on the first iteration, so just pull it out
of the loop entirely. This makes it clear it has nothing to do with the loop.
2015-07-27 18:49:49 -04:00
Olivier Crête
431f3e0e6f avviddec: Only create the AVBuffer once the stride is validated
If it is created earlier and the stride is invalid, then the frame
will be freed and it won't be possible to use it in the fallback path.
Not doing this causes a segfault because it will try to use
already freed memory.
2015-07-27 18:46:17 -04:00
Olivier Crête
2e621f8dbf avviddec: Re-enable direct rendering 2015-07-27 15:29:49 -04:00
Olivier Crete
3b6c656e25 avauddec: Read channels from the channels field
If there is no layout, just read the channel count from the
channels field.

https://bugzilla.gnome.org/show_bug.cgi?id=752186
2015-07-27 14:18:32 -04:00
Olivier Crête
6bfe79d903 avviddec: Ignore negotiation error on shutdown
https://bugzilla.gnome.org/show_bug.cgi?id=752800
2015-07-27 13:58:43 -04:00
Olivier Crête
7afaf5c020 avauddec: Access field using accessors
Those fields are documented to only be safe to access using
accessors as their position is not part of the ABI.
2015-07-25 03:06:10 -04:00
James Smith
f92bf2618c Add support for musepack (mpc) sv8 audio
https://bugzilla.gnome.org/show_bug.cgi?id=732682
2015-07-22 09:44:27 +01:00
Vineeth T M
7d3c7109ac avviddec: fix slice_offset memory leak
In case of real videos, slice_offset is being allocated,
but the same is not being freed.

https://bugzilla.gnome.org/show_bug.cgi?id=752404
2015-07-21 11:20:07 +01:00
Sebastian Dröge
5d2e9b7b80 Make the LGPL build the default and require --enable-gpl to build a GPL licensed version 2015-07-01 22:40:02 +02:00
Sebastian Dröge
b526816cfe avmux: Blacklist some subtitle and adaptive streaming muxers 2015-07-01 22:11:52 +02:00
Sebastian Dröge
97f58baecd Switch from libav v11.4 to ffmpeg n2.7.1
ffmpeg seems to be the one of the two forks, which is most widely used by
Linux distributions and in general. Also Google is using it for e.g. Chrome
and has engineers working on finding and fixing security issues in it.

https://bugzilla.gnome.org/show_bug.cgi?id=751607
2015-07-01 21:40:00 +02:00
Sebastian Dröge
1dcdeb977c avaudenc: Remember how many samples the codec consumed for telling the base class 2015-06-30 20:01:46 +02:00
Thomas Bluemel
30a4a28793 avauddec: Ensure input buffers have FF_INPUT_BUFFER_PADDING_SIZE padding, which is required by avcodec_decode_audio4 () 2015-06-30 19:19:42 +02:00
Sebastian Dröge
626152dd6f avmux: Ignore stream_segment,ssegment muxer that is provided by ffmpeg
The comma confuses our code, e.g. it's not a valid element name or structure
name.
2015-06-29 13:29:05 +02:00
Sebastian Dröge
8271b2755a avvidenc: Fix compiler warning
gstavvidenc.c: In function 'gst_ffmpegvidenc_flush_buffers':
gstavvidenc.c:733:7: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       GstFFMpegVidEncClass *oclass =
       ^
cc1: all warnings being treated as errors
2015-06-28 16:54:35 +02:00
Sebastian Dröge
e964dcdb02 avvidenc: Set AVFrame flags for interlacing per frame and not in set_format()
They will get overridden by av_frame_unref() with the defaults.
2015-06-28 16:35:46 +02:00
Sebastian Dröge
45ab256e54 av{aud,vid}enc: Create wrapped output buffers with GST_MEMORY_FLAG_READONLY
libav might still have references to the buffers itself and uses a writability
system similar to ours based on reference counts.
2015-06-28 16:32:02 +02:00
Sebastian Dröge
6998d982c7 avvidenc: Properly wrap and free the output AVPackets generated during draining 2015-06-28 16:30:54 +02:00
Sebastian Dröge
3943cdf18a avvidenc: Make sure to keep input data alive until libav is done with it 2015-06-28 16:27:52 +02:00
Sebastian Dröge
3ca7c041b1 avaudenc: Make sure to keep input data alive until libav is done with it 2015-06-28 16:21:33 +02:00
Sebastian Dröge
d6b5fc4f34 av{aud,vid}enc: Stop using deprecated AVFrame APIs 2015-06-28 15:37:23 +02:00
Sebastian Dröge
2a445cb5f2 avauddec: Remove custom buffer allocation function
libav always uses planar audio formats nowadays, not much use in
us trying to allocate anything here until we add support for planar
aka non-interleaved audio formats at least in audioconvert.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
4240ff2bfc avauddec: Use undeprecated AVFrame API 2015-06-28 12:41:55 +02:00
Sebastian Dröge
3d9816ce7f avviddec: Free frame before the codec is freed
Who knows, maybe freeing the frame calls cleanup inside the codec.
2015-06-28 12:41:55 +02:00
Sebastian Dröge
982f5262d4 avviddec: Use undeprecated AVFrame API and unref frame once we're done with it 2015-06-28 12:41:55 +02:00
Sebastian Dröge
0767bdda5f avauddec: Negotiate based on the AVFrame instead of just the AVCodecContext 2015-06-28 12:41:55 +02:00
Sebastian Dröge
523ddb5346 avviddec: Use the new get_buffer2() API instead of the deprecated APIs
And do the frame reference counting by adding AVBufferRefs to the frame.
2015-06-28 12:41:55 +02:00