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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
It triggers SettingsChanged on the other port and it is up to
the client to decide if it should lead to a port reconfiguration.
Settings are propagated to the other port for fields they have
in common. But this event is only triggered on the other port
if it actually change a setting.
https://bugzilla.gnome.org/show_bug.cgi?id=783976
Can happen if gst_buffer_pool_acquire_buffer succeeds but
gst_buffer_n_memory (buffer) is not exactly 1.
In theory this should not happen because the decoder requests
EGLImage(RGBA) but better to fix any leak on corner cases.
https://bugzilla.gnome.org/show_bug.cgi?id=784365