Commit graph

33 commits

Author SHA1 Message Date
Matthew Waters
640a65bf96 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2098>
2021-03-22 14:34:36 +11:00
Jan Schmidt
6c1e5ab311 androidmedia: Support float i-frame-interval
Android 25 added support for i-frame-interval to be a floating
point value. Store the property as a float and use the newer
version when it's available.
2020-02-09 02:19:12 +11:00
Jan Schmidt
29e3d09014 androidmedia: Allow dynamic bitrate changes on Android >= 19
Android 19 added an API for dynamically changing the bitrate in a running
codec.

Also make it so that even when not update-able at runtime, parameters will at least
be stored so that they take effect the next the codec is restarted.
2020-02-09 02:19:12 +11:00
Jan Schmidt
1b8bf1be01 androidmedia: Handle force-keyunit requests
Use API from Android 19 to request a keyframe from the MediaCodec
when indicated by the base class.
2020-02-09 02:19:12 +11:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Xavier Claessens
ad7c4f5f27 amc: Select between encoder/decoder at GstAmcCodec construct time
Magical 0/1 values where passed to gst_amc_codec_configure() flags
argument. It's more natural to have a boolean is gst_amc_codec_new().
2019-08-20 08:53:55 -04:00
Tim-Philipp Müller
c39fd4d898 androidmedia: add Hardware tag to element metadata 2019-02-19 23:45:34 +00:00
Ursula Maplehurst
236398ee3f androidmedia: when flushing, better handle IllegalStateException received from getOutputBuffer
1. Similar to 880f3d8, don't consider not getting an output buffer as
   an error during flushing. I've seen the following sometimes when
   encoding:

   W GStreamer+amcvideoenc: java.lang.IllegalStateException
   W GStreamer+amcvideoenc:         at android.media.MediaCodec.getBuffer(Native Method)
   W GStreamer+amcvideoenc:         at android.media.MediaCodec.getOutputBuffer(MediaCodec.java:2886)

2. For amcvideodec/enc, call _find_nearest_frame (which grabs a fresh
   reference on a GstVideoCodecFrame) after we have an output buffer,
   so as to not leak the reference, in case getting an output buffer
   fails.

   Otherwise, if we get an error grabbing the output buffer, we leak
   the reference to the frame. This can cause issues with a
   v4l2bufferpool feeding the encoder not being able to clean itself
   up properly due to buffers still being marked as in-use.

https://bugzilla.gnome.org/show_bug.cgi?id=791258
2017-12-06 10:32:02 +02:00
shakin chou
febbaaddcf amcvideodec/enc: Correctly check for no PTS on input buffers
MediaCodec gives us a presentation timestamp of 0 if it does not know
anything, but GStreamer gives us GST_CLOCK_TIME_NONE. Don't mix up these
two.

https://bugzilla.gnome.org/show_bug.cgi?id=780190
2017-04-26 13:40:28 +03:00
Sebastian Dröge
aca89aeeaa amcvideoenc: Encoder output is generally not properly parsed
Don't claim it is and let h264parse and other parsers do their job.

https://bugzilla.gnome.org/show_bug.cgi?id=774772
2017-02-08 00:05:47 +02:00
Sebastian Dröge
7817f85759 amcvideoenc: Set timestamps on header buffers too
https://bugzilla.gnome.org/show_bug.cgi?id=774772
2017-02-08 00:05:47 +02:00
Sebastian Dröge
c27091d67f amcvideoenc: Encoded H264 is generally not AU aligned
Claiming that it is, can cause h264parse to skip some parsing steps and
the output stays unaligned.

https://bugzilla.gnome.org/show_bug.cgi?id=774772
2017-02-08 00:05:47 +02:00
Sebastian Dröge
5619690ae1 androidmedia: Add support for VP9 2017-01-04 20:59:39 +02:00
Thibault Saunier
2fb716409c Use the new API to post flow ERROR messages on the bus
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-26 19:23:31 -03:00
Xavier Claessens
1ee15d1385 amcvideoenc: Do not call gst_object_unref on GstCaps
https://bugzilla.gnome.org/show_bug.cgi?id=767298
2016-06-06 17:53:01 +01:00
Sebastian Dröge
610705cbb4 amc: Correctly handle NULL input buffers
https://bugzilla.gnome.org/show_bug.cgi?id=763401
2016-03-11 10:46:10 +02:00
Sebastian Dröge
5a3744e86c amc: MediaCodec::getOutputBuffer() can return NULL without exception
Happens when doing zerocopy rendering, or when passing a wrong index to it.
Handle this properly for zerocopy rendering, fail properly for the other
cases.

https://bugzilla.gnome.org/show_bug.cgi?id=760961
2016-01-22 16:13:45 +02:00
Matthieu Bouron
43b63f304d androidmedia: Add support for GL output in amcvideodec
https://bugzilla.gnome.org/show_bug.cgi?id=731204
2015-10-21 04:27:43 +11:00
Edward Hervey
88cd44fbd8 androidmedia: Fix debug statement (%d for a gsize argument) 2015-10-21 04:27:43 +11:00
Sebastian Dröge
431c4b5e84 amcvideoenc: Always set i-frame-interval setting
Most encoders fail to initialize if we don't set it at all.
2015-07-29 10:13:17 +01:00
Sebastian Dröge
42a1a95f3e androidmedia: Add support for H265/HEVC 2015-07-08 11:42:48 +03:00
Sebastian Dröge
a6fb482247 androidmedia: Conditionally use get_{input,output}_buffer() Android 21 APIs
Also properly set limit/position on byte buffer, some codecs prefer to have
correct values there.
2015-05-31 21:27:27 +02:00
Sebastian Dröge
8f25220b9c androidmedia: Make sure to unblock any thread waiting on the drain condition variable when errors happen 2014-08-14 15:27:21 +03:00
Sebastian Dröge
ca62186797 androidmedia: Fix draining logic to let the base class handle EOS events
https://bugzilla.gnome.org//show_bug.cgi?id=734775
2014-08-14 15:27:21 +03:00
Sebastian Rasmussen
c1d5aa3da5 amcvideoenc: Avoid leaking copy of caps object
gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
so creating a copy using gst_caps_copy() results in a reference leak.
Also remove the incorrect comment to avoid confusion in the future.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734533
2014-08-10 12:11:10 +01:00
Sebastian Dröge
aee9d12b86 androidmedia: Also don't report warnings for queue/dequeue errors during flushing in error cases
... and fix a case where we released an invalid buffer index.
2014-06-19 18:34:05 +02:00
Sebastian Dröge
880f3d8a18 androidmedia: Don't consider input buffer queueing failures as an error during flushing 2014-06-19 18:34:05 +02:00
Sebastian Dröge
71c0e0e19f androidmedia: Clean up flushing code and don't consider output buffer releasing failures during flushing as an error 2014-06-19 18:34:05 +02:00
Sebastian Dröge
f844af2320 androidmedia: Add exceptions from the Java API to error messages, and post more error/warning messages overall 2014-05-30 16:36:11 +02:00
Chen Jie
8e0bbc9e32 androidmedia: add gst_amc_color_format_copy
gst_amc_color_format_copy will copy in/out a frame resides at a
GstAmcBuffer. Lots of codes in gst_amc_video_*_fill_buffer are moved to
this new function.
2014-05-26 16:29:01 +02:00
Chen Jie
557d6b974f androidmedia: move create_src|sink_caps to gstamc.c
Some hack logic needs also to be present in create_src|sink_caps, for
working around some broken codecs. These hacks are hidden
in color_format/video_format conversion -- the prototypes of these
functions are also changed to include more args for hack judgement.

Also in case of multi-color_formats mapped to one video_format, then
map that video_format back will not give the original color_format, which
causes gst_amc_codec_configure failed with something like
'does not support color format N'.

The new prototype involves with GstAmcCodecInfo and mime, which
ensures the converted color_format is supported by the codec.

A COLOR_FormatYCbYCr to GST_VIDEO_FORMAT_YUY2 mapping is also added, in
order to work around bugs in OMX.k3.video.decoder.avc(which incorrectly
reports supporting COLOR_FormatYCbYCr, which is actually
COLOR_FormatYUV420SemiPlanar). There are already hacks for this in
gst_amc_video_format_to_color_format, gst_amc_color_format_to_video_format
and gst_amc_color_format_info_set, but the codec will still not work(be
ignored because of "has unknown color formats") without adding this mapping.
2014-05-26 16:29:01 +02:00
Chen Jie
27f4d8237f amcvideoenc: Unit of bitrate property is now bit/sec
https://bugzilla.gnome.org/show_bug.cgi?id=705129
2014-05-26 12:10:44 +02:00
Chen Jie
22c0464aa6 androidmedia: add support for video encoding
https://bugzilla.gnome.org/show_bug.cgi?id=705129
2014-05-23 09:37:54 +02:00