Commit graph

1036 commits

Author SHA1 Message Date
Julien Isorce
6600a520a5 omxvideodec: consolidate the decision to try UseBuffer
The tee element can call gst_query_add_allocation_pool with pool as NULL.
Checking nth > 0 is not enough so we need to verify if there is a pool.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
https://bugzilla.gnome.org/show_bug.cgi?id=784069
2017-12-13 12:14:48 +00:00
Julien Isorce
0d2d695eff gstomxvideodec: fix framerate overflow
Some live streams can set the framerate to 50000/1677 (=29.81).

GstVideoInfo.fps_n << 16 is wrong if the fps_n is 50000
(i.e. greater than 32767).

https://bugzilla.gnome.org/show_bug.cgi?id=759043
2017-12-13 10:12:05 +00:00
Julien Isorce
71ddf32df9 example: port testegl.c to desktop
Will be easier to maintain.

Also uniformize autotool build with meson build which is
already retrieving the gl libs.

https://bugzilla.gnome.org/show_bug.cgi?id=781606
2017-12-11 16:59:01 +00:00
Julien Isorce
ff74c66a9a meson: move omx features check after target selection
And uses gst_omx_args instead of add_global_arguments.

Similar to c692328521
which was only for configure.ac

Useful to get omxvp8dec with meson too:
  meson . buildtmp -D with_omx_target=tizonia

https://bugzilla.gnome.org/show_bug.cgi?id=782800
2017-12-11 15:59:22 +00:00
Julien Isorce
cefbbbc8bf config: add OMX.Aratelia.audio_decoder.aac to Tizonia config
Useful mostly for testing/debugging purpose as this is a software
based decoder (libfaad) for which GStreamer provides a direct
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=791482
2017-12-11 15:09:38 +00:00
Guillaume Desmottes
56654cced5 omxvideodec: retrieve OMX_IndexParamVideoPortFormat before setting it
The usual pattern when setting OMX params is to first get the struct
param, override the values we want to set and then set the updated
param.
We were not doing this with OMX_IndexParamVideoPortFormat and so were
resetting some fields such as OMX_VIDEO_PARAM_PORTFORMATTYPE.xFramerate

https://bugzilla.gnome.org/show_bug.cgi?id=790979
2017-11-29 12:41:37 -05:00
Julien Isorce
6364463918 omxaacenc: also set 'profile' if mpegversion is 4
Like done by gst_codec_utils_aac_caps_set_level_and_profile
which is called by avenc_aac, ffaac and voaacenc.

https://bugzilla.gnome.org/show_bug.cgi?id=735208
2017-11-29 16:13:24 +00:00
Guillaume Desmottes
4211e4c29a omx: wait for flush complete and buffers being released when flushing
As stated in the existing comment, when flusing we should wait for OMX
to send the flush command complete event AND all ports being released.
We were stopping as soon as one of those condition was met.

Fix a race between FillThisBufferDone/EmptyBufferDone and the flush
EventCmdComplete messages. The OMX implementation is supposed to release
its buffers before posting the EventCmdComplete event but the ordering
isn't guaranteed as the FillThisBufferDone/EmptyBufferDone and
EventHandler callbacks can be called from different threads (cf 2.7
'Thread Safety' in the spec).

https://bugzilla.gnome.org/show_bug.cgi?id=789475
2017-11-28 13:35:07 -05:00
Guillaume Desmottes
4c0a8a6d90 gst_omx_port_set_flushing: simplify waiting loop
No semantic change so far, I just made the 'while' end condition easier
to understand as a first step before changing it.
- move error/time out checks inside the loop to make it clearer on what
we are actually waiting for.
- group port->buffers checks together with parenthesis as they are part
of the same conceptual check: waiting for all buffers to be released.

https://bugzilla.gnome.org/show_bug.cgi?id=789475
2017-11-28 13:35:07 -05:00
Matthew Waters
0b4931236b Automatic update of common submodule
From 3f4aa96 to e8c7a71
2017-11-27 20:17:17 +11:00
Guillaume Desmottes
a4c18ff243 zynqultrascaleplus: add support for extra AVC levels
The Zynqultrascaleplus has support for extra AVC levels not defined in
the OMX spec as a customer extension.

https://bugzilla.gnome.org/show_bug.cgi?id=790758
2017-11-23 11:39:33 -05:00
Guillaume Desmottes
4f91b6f873 add test support
Most of the boilerplate and the states test has been copied from
gst-plugins-good.

https://bugzilla.gnome.org/show_bug.cgi?id=789094
2017-10-19 16:44:06 +02:00
Guillaume Desmottes
b3d63d613a meson: add tools support
Looks like the tools directory was left out during the initial port to
meson.

https://bugzilla.gnome.org/show_bug.cgi?id=789090
2017-10-19 16:43:55 +02:00
Guillaume Desmottes
6d44c0add5 omx: fix build on rpi
The nTimeStamp field is a OMX_TICKS struct on the rpi so use the proper
macro to set it.
Fix build on the build which has been broken by
b3173144b7

https://bugzilla.gnome.org/show_bug.cgi?id=789052
2017-10-19 16:23:01 +02:00
Guillaume Desmottes
a0e7fc79e3 check if Allegro headers are present when building zynqultrascaleplus
The Zynq UltraScale+ uses a custom version of OMX implementing several
3rd party extensions. Make sure those are present when building this
target.

https://bugzilla.gnome.org/show_bug.cgi?id=788064
2017-10-19 16:20:39 +02:00
Guillaume Desmottes
62b96b6e14 omxvideodec: remove redundant debug message
We have already a debug message right after.

https://bugzilla.gnome.org/show_bug.cgi?id=789058
2017-10-19 16:20:10 +02:00
Guillaume Desmottes
2da61ef2bf omxh265: fix enum casting when using Allegro HEVC extensions
Allegro's HEVC implementation defines a superset of the profiles and
enums from the Android implementation.
Properly cast to fix -Wenum-conversion warnings from clang.

https://bugzilla.gnome.org/show_bug.cgi?id=789057
2017-10-19 16:19:16 +02:00
Guillaume Desmottes
cc0e3c8320 properly cast extension enums
OMX's allow 3rds party to define extensions using their own enums
(like OMX_VIDEO_CODINGEXTTYPE) and to be used as the general
ones (like OMX_VIDEO_CODINGTYPE).
Properly cast those to fix -Wenum-conversion warnings from some
compilers such as clang.

https://bugzilla.gnome.org/show_bug.cgi?id=789057
2017-10-19 16:19:16 +02:00
Guillaume Desmottes
b3173144b7 omx: also reset nTimeStamp when re-using buffers
Some OMX implementations may check if the timestamp of the output buffers
they receive is actually not set.

https://bugzilla.gnome.org/show_bug.cgi?id=788711
2017-10-11 13:51:55 -04:00
Guillaume Desmottes
514699594d omx: factor out gst_omx_buffer_reset()
https://bugzilla.gnome.org/show_bug.cgi?id=788711
2017-10-11 13:51:55 -04:00
Guillaume Desmottes
3a0e4bc35d add gst_omx_buffer_flags_to_string()
Make debug logs more readable so users don't have to manually figure out
the meaning of flags.

https://bugzilla.gnome.org/show_bug.cgi?id=788767
2017-10-11 13:49:30 -04:00
Ponnam Srinivas
8556596862 h263enc: fix caps leak in error code path
https://bugzilla.gnome.org/show_bug.cgi?id=788245
2017-09-28 13:24:07 +03:00
Ponnam Srinivas
1f36637434 omxh264enc: fix caps leak
https://bugzilla.gnome.org/show_bug.cgi?id=787711
2017-09-22 11:53:01 +03:00
Ponnam Srinivas
27cd61a21a omxh265enc: fix caps leak
https://bugzilla.gnome.org/show_bug.cgi?id=787714
2017-09-21 20:48:50 -04:00
Guillaume Desmottes
1bc6976b7b omxvideodec: log info about frame before releasing it
gst_video_decoder_release_frame() takes ownership of the frame and will
destroy it. So we should no longer use it after calling it.

https://bugzilla.gnome.org/show_bug.cgi?id=787628
2017-09-14 17:39:06 +01:00
Gurkirpal Singh
f905af8d8e configure: Show tizonia target in help
https://bugzilla.gnome.org/show_bug.cgi?id=786544
2017-09-09 16:49:35 +01:00
Guillaume Desmottes
5751001ddc omxh265dec: add H265 decoder
Add HEVC decoder for the zynqultrascaleplus platform.

I used the H264 decoder code as a template.

https://bugzilla.gnome.org/show_bug.cgi?id=785434
2017-09-06 14:50:18 -04:00
Guillaume Desmottes
cf9f1903db omxh265enc: add H265 encoder
The OMX spec doesn't support HEVC but the OMX stack of the
zynqultrascaleplus adds it as a custom extension.
It uses the same API as the one of Android's OMX stack.

I used the H264 encoder code as a template.

https://bugzilla.gnome.org/show_bug.cgi?id=785434
2017-09-06 14:50:18 -04:00
Guillaume Desmottes
79df3b0e8e omxvideoenc: use caps from query in propose_allocation
Prevent crash by not deferencing a NULL pointer if self->input_state
isn't defined when propose_allocation() is called.

https://bugzilla.gnome.org/show_bug.cgi?id=786442
2017-09-06 09:15:31 -04:00
Guillaume Desmottes
318ef5b357 omx: display states as string if changing failed
Improve the error message by displaying the states in their string
representation rather than their numerical value.

https://bugzilla.gnome.org/show_bug.cgi?id=787235
2017-09-04 08:46:07 +01:00
Julien Isorce
054d5da46e omxvideodec: EGLDisplay is not indirectly defined by gstgl headers inclusion
Just use gpointer as done in GstGL to not include
EGL/egl.h just for EGLDisplay.

https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-08-22 10:29:05 +01:00
Gurkirpal Singh
ac6f3ab3d3 config: expose OMX.mesa h264 decoder and encoder in Tizonia config
https://bugzilla.gnome.org/show_bug.cgi?id=783976
2017-08-17 14:09:53 +01:00
Julien Isorce
bb3778a1ac omxvideodec: remove wrong SettingsChanged ack
Partially revert 1b7d0b8:
  omxvideodec: handle IL 1.2 behavior for OMX_SetParameter

It turned out it was a problem in the decoder which was
not updating some local variables upon SetParameter.

https://bugzilla.gnome.org/show_bug.cgi?id=783976
2017-08-17 14:08:24 +01:00
Julien Isorce
eec88a9651 omx{audio,video}{dec,enc}: sequentially disable ports because buffers are not shared
For the history, the parallel disable port has been introduced by:
"00be69f omxvideodec: Disable output port when setting a new format"
and then replicated to videoenc, audiodec and audioenc.

This is only required to do 'parallel' if buffers are shared between ports.
But for decoders and encoders the input and output buffer are of different
nature by definition (bitstream vs images). So they cannot be shared.

Also starting from IL 1.2.0 it is written in the spec that the parallel
disable is not allowed and will return an error. Except when buffers are
shared.

Again here we know in advance that they are not shared so let's always
do a sequential disable.

Tested on Desktop, rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=786348
2017-08-17 14:01:27 +01:00
Tim-Philipp Müller
7dda0e7f17 Automatic update of common submodule
From 48a5d85 to 3f4aa96
2017-08-17 12:26:05 +01:00
Guillaume Desmottes
6d2082003a omxvideodec: use the decoder API to set latency
https://bugzilla.gnome.org/show_bug.cgi?id=785125
2017-08-10 13:58:31 -04:00
Guillaume Desmottes
f2b0b66e39 omxvideoenc/dec: declare latency on zynqultrascaleplus
The OMX specification doesn't provide any API to expose the latency
introduced by encoders and decoders. We implemented this as a custom
extension as declaring the latency is needed for live pipelines like
video conferencing.

https://bugzilla.gnome.org/show_bug.cgi?id=785125
2017-08-09 17:01:15 -04:00
Guillaume Desmottes
0ee8213ab2 omxvideoenc: adjust stride and slice height from input
Use the stride and slice height information from the first buffer meta
data to adjust the settings of the input port.
This will ensure that the OMX input buffers match the GStreamer ones
and so will save us from having to copy line-by-line each one.

This is also the first step to allow the OMX encoder to receive dmabuf.

Tested on rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
07e80c9425 omxvideoenc: delay buffer configuration until component is enabled
No significant change for now. Just delay the input port configuration
of the buffer size related fields (stride, slice height, buffer size)
until the component is activated.
This will allow us to use the actual stride/height of the first input
and so avoid the buffer copying code path in most cases.

Tested on rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
0603e442ce omxvideodec/enc: delay allocation after the allocation query
Allocating OMX components buffers in set_format() is too early.
Doing it when receiving the first buffers will allow the element to use
the information from the allocation query and/or the first incoming
buffer to pick to best allocation mode.

Tested on raspberry pi with dynamic resolution changes on decoder and
encoder input.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
90da3c665e omxvideoenc: start src thread in handle_frame()
Makes the code simpler as we no longer need to restart the thread in
gst_omx_video_enc_flush() and It's more symetric which the omxvideodec
implementation.

I'm also going to move the enabling of the OMX component in
handle_frame() and the src pad thread needs to be started after it.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
7916bd53ab omxvideodec: earlier return if downstream_flow_ret is not OK
There is no point to (re)start the src thread if, for example, we are
flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
352184dd09 omxvideodec: factor out enable and disable code
No semantic change, just factor out the code enabling and disabling the
component to their own functions.

Makes the code easier to read as the set_format() method was already
pretty big. Will also allow us to easily change the enabling logic.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
973c6e109a omxvideoenc: factor out enable and disable code
No semantic change, just factor out the code enabling and disabling the
component to their own functions.

Makes the code easier to read as the set_format() method was already
pretty big. Will also allow us to easily change the enabling logic.

https://bugzilla.gnome.org/show_bug.cgi?id=785967
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
7a0949b750 omx: also reset nFilledLen before calling OMX_FillThisBuffer()
The spec states that the buffer passed to OMX_FillThisBuffer() needs to be
empty. Some implementation may check it actually is by checking its
nFilledLen field, so best to reset it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=785623
2017-08-01 11:26:11 -04:00
Julien Isorce
86d9a2c81c omxvideodec: make generic the OMX_UseEGLImage code path
Will be easier to maintain and to make enhancements.

Tested with Tizonia on Desktop.
Also tested with Bellagio to make sure it does not crash when
calling OMX_UseEGLImage and indeed it returns NotImplemented.
Then gst-omx fallback to OMX_UseBuffer if it can and so on.

Also tested on rpi to make sure there is no regression.

https://bugzilla.gnome.org/show_bug.cgi?id=784365
2017-08-01 10:18:21 +01:00
Nicolas Dufresne
64f7f781d8 omxvideodec: Fix segment seek
On segment seek, unlike EOS, we drain, but we cannot expect a flush
later to reset the decoder state. As a side effect, the decoder would
remain in EOS state and ignore any new incoming buffers.

To fix this, we call _flush() inside the _drain() function, and
_finish() becomes what _drain() was before. This way, for _finish() (the
    eos case) we only drain, for _drain() triggered by segment seek or new
caps, we also reset the decoder state so it's ready to accept buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=785237
2017-07-21 11:59:50 -04:00
Guillaume Desmottes
3f5d98a360 omxvideoenc: ensure enough buffers are allocated in the pool
Handle allocation query and ensure enough buffers are allocated in
the negotiated pool. This help preventing buffer starvation in the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=785122
2017-07-19 09:37:37 -04:00
Guillaume Desmottes
136714c6ed omxvideodec: add dmabuf support for output
The zynqultrascaleplus OMX implementation has a custom extension
allowing decoders to output dmabuf and so avoid buffers copy between OMX
and GStreamer.

Make use of this extension when built on the zynqultrascaleplus. The
buffer pool code should be re-usable for other platforms as well.

https://bugzilla.gnome.org/show_bug.cgi?id=784847
2017-07-18 23:46:46 +01:00
Julien Isorce
a9a3087021 config: add OMX.Aratelia.video_decoder.vp8 to Tizonia config
Useful mostly for testing/debugging purpose as this is a software
based encoder (libvpxdec) for which GStreamer provides a direct
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783976
2017-07-18 23:45:11 +01:00