Commit graph

156 commits

Author SHA1 Message Date
Luis de Bethencourt
70c48cf85f omx: handle both errors in the two steps of update_port_definition
Also consider potential errors in the _get_parameter() in the return of the
update_port_definition function.

CID #1287052
2015-03-06 12:06:22 +00:00
George Kiagiadakis
0ef1e90b34 omx: call handle_messages() only once in acquire_buffer() to avoid potential deadlock
There is one rare case where calling handle_messages() more than once can cause a deadlock
in the video decoder element:

- sink pad thread starts the src pad task (gst_omx_video_dec_loop())
- _video_dec_loop() calls gst_omx_port_acquire_buffer() on dec_out_port
- blocks in gst_omx_component_wait_message() releasing comp->lock and comp->messages_lock
  (initially, there are no buffers configured on that port, so it waits for OMX_EventPortSettingsChanged)
- the sink pad thread pushes a buffer to the decoder with gst_omx_port_release_buffer()
- _release_buffer() grabs comp->lock and sends the buffer to OMX, which consumes it immediately
- EmptyBufferDone gets called at this point, which signals _wait_message() to unblock
- the message from EmptyBufferDone is processed in gst_omx_component_handle_messages()
  called from gst_omx_port_release_buffer()
- gst_omx_port_release_buffer releases comp->lock
- the src pad thread now gets to run, grabbing comp->lock while it exits from _wait_message()
- _acquire_buffer() calls the _handle_messages() on the next line after _wait_message(),
  which does nothing (no pending messages)
- then it goes to "retry:" and calls _handle_messages() again, which also does nothing
  (still no pending messages)
- scheduler switches to a videocore thread that calls EventHandler, informing us about the
  OMX_EventPortSettingsChanged event that just arrived
- EventHandler graps comp->messages_lock, but not comp->lock, so it can run in parallel at
  this point just fine.
- scheduler switches back to the src pad thread (which is in the middle of _acquire_buffer())
- the next _handle_messages() which is right before if (g_queue_is_empty (&port->pending_buffers))
  processes the OMX_EventPortSettingsChanged
- the buffer queue is still empty, so that thread blocks again in _wait_message()
- the sink pad thread tries to acquire the next input port buffer
- _acquire_buffer() also blocks this thread in:
   if (comp->pending_reconfigure_outports) { ... _wait_message() ... }
- DEADLOCK. gstreamer is waiting for omx to do something, omx waits for gstreamer to do something.

By removing those extra _handle_messages() calls, we can ensure that all the checks of
_acquire_buffer() will re-run. In the above case, after the scheduler switches back to
the middle of _acquire_buffer(), the code will enter _wait_message(), which will see that
there are pending messages and will return immediately, going back to "retry:" and
re-doing all the checks properly.

https://bugzilla.gnome.org/show_bug.cgi?id=741854
2015-03-04 09:51:03 +01:00
Wonchul Lee
df58d8baac omx: cleanup code a bit to remove else statement
https://bugzilla.gnome.org/show_bug.cgi?id=745191
2015-02-26 11:15:37 +02:00
Jun Ji
8936f6634c omx: Add omxamrdec
https://bugzilla.gnome.org/show_bug.cgi?id=739333
2014-11-13 13:32:16 +01:00
Sebastian Dröge
03cf0bc9a4 omx: Add AAC audio decoder 2014-07-13 18:22:39 +02:00
Sebastian Dröge
0c3b3ef3d0 omx: Add audio decoder base class and a subclass for MP3 2014-07-02 09:21:00 +02:00
Kazunori Kobayashi
4c488d425d omx: Fix a missing g_free() in error path
This fixes a memory leak with g_strdup() when an error occurs.

https://bugzilla.gnome.org/show_bug.cgi?id=731141
2014-06-03 09:23:41 +02:00
Sebastian Dröge
190adce125 omx: Don't handle disabling/enabling ports exactly like flushing
Otherwise we might abort a flush operation in another thread when
enabling/disabling ports, leading to deadlocks sometimes.

https://bugzilla.gnome.org/show_bug.cgi?id=730989
2014-05-31 15:12:05 +02:00
Sebastian Dröge
59ac1dd03b omx: Remove dead code, buf can never be NULL here as we just check for that the line above
CID 1214596
2014-05-19 08:48:50 +02:00
Sebastian Dröge
800ef8ab14 omx: Fix comparisons in gst_omx_state_to_string() case to actually make sense
CID 1214593
2014-05-19 08:47:36 +02:00
Sebastian Dröge
7b558e37bc omx: Make sure to compare the error codes as unsigned integers so that comparisons >2**31 actually work
CID 1214592
2014-05-19 08:47:33 +02:00
Sebastian Dröge
93528dc43b omx: Fix comparisons in gst_omx_command_to_string() default cause to actually work
CID 1214591
2014-05-19 08:44:55 +02:00
Sebastian Dröge
4e20116bc6 omx: Add a hack for not disabling the output port after set_format until the output format is known
Needed on some OMX implementations, e.g. the one from Atmel. It does
not send the settings-changed event on the output port if it is
disabled.
2014-05-15 10:59:35 +02:00
Josep Torra
b3eb4d897d omxaudiosink: Implements OpenMAX based audio sinks
Provides omxanalogaudiosink and omxhdmiaudiosink elements on
the Raspberry PI.

- omxanalogaudiosink is capable to render raw mono or stereo audio
through the jack output.
- omxhdmiaudiosink is capable to render raw audio up to 8 channels
and transmit ac3/dts(IEC 61937) through the HDMI output.
- sinks provide a clock derived from rendered samples
- sinks support the GstStreamVolume interface by implementing
the volume and mute properties.

https://bugzilla.gnome.org/show_bug.cgi?id=728962
2014-05-09 13:15:18 +02:00
Christian König
8a860bd024 omxvideo: fix debug category initialisation
https://bugzilla.gnome.org/show_bug.cgi?id=726024
2014-03-15 12:42:03 +01:00
Christian König
0700d6875f omx: consolidate message waiting code
Add a wait_message helper function and remove all those duplicated code.

https://bugzilla.gnome.org/show_bug.cgi?id=725493
2014-03-12 14:04:57 +01:00
Christian König
de5f940186 omx: simplify tunnel functions
Specifying the component is error prone and unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=726021
2014-03-12 08:48:46 +01:00
Christian König
8b06b07f6f omx: fix two serious message handling bugs
Waiting for the next message if we already got one
is nonsense and can lead to lockups.

https://bugzilla.gnome.org/show_bug.cgi?id=725468
2014-03-02 12:09:59 +01:00
Tim-Philipp Müller
498b74ab6a omx: don't use the 'z' modifier to print size_t
gcc will warn in some cases even if the size of the type
is exactly that of size_t on the platform.

https://bugzilla.gnome.org/show_bug.cgi?id=699008
2013-08-20 16:00:07 +01:00
jitendra
715b44ea66 omx: Add pads based on element type
This allows to later add sources and sink that only have a srcpad
or sinkpad.

https://bugzilla.gnome.org/show_bug.cgi?id=699754
2013-05-06 16:20:20 +02:00
Carlos Rafael Giani
2d1138f45c omx: fixed type error in printf call
%zu expects size_t

https://bugzilla.gnome.org/show_bug.cgi?id=699008
2013-04-27 09:17:28 +01:00
Tim-Philipp Müller
2cbbab3128 omx: more printf format fixes
Fix printf formats again, so that gst-omx compiles warning-
free on the Raspberry Pi as well. Unfortunately OMX_UINT32
maybe be typedefed to uint32_t or unsigned long, which
doesn't work well with our debugging printf format strings,
so just use %u for those and cast to guint.
2013-04-18 23:10:13 +01:00
Josep Torra
82807bd9dd omx: fixes unused variable 'comp' when GStreamer is built without debug 2013-04-18 16:40:06 +02:00
Tim-Philipp Müller
0c08d375f4 omx: fix printf formats in debug messages
OMX_U32 is typedefed to an unsigned long,
OMX_TICKS to a 64-bit integer.
2013-04-08 17:02:32 +01:00
Sebastian Dröge
8a1bb1b4a3 omxvideodec: Add support for egl_render on RPi 2013-03-26 14:00:03 +01:00
Sebastian Dröge
8460cabd13 omx: Add Theora decoder 2013-03-19 12:25:27 +01:00
Sebastian Dröge
29a348efac omx: Remove additional comma 2013-03-18 16:43:24 +01:00
Sebastian Dröge
36e76faa05 omx: Rename MPEG2 decoder for consistency everywhere 2013-03-18 16:34:51 +01:00
Sebastian Dröge
d9d46263c6 omx: Add MJPEG decoder support 2013-03-18 16:34:51 +01:00
Sebastian Dröge
0f5e6e967b omx: Add VP8 decoder support 2013-03-18 16:34:51 +01:00
Josep Torra
8231c9068e omx: minor stylistic change for consistency with other similar code 2013-03-16 10:13:06 +01:00
Tim-Philipp Müller
c51afe9093 omx: improve debug logging some more 2013-03-15 13:17:18 +00:00
Sebastian Dröge
35a13a2cea omx: Reset EOS flag in more places 2013-03-15 11:01:12 +01:00
Tim-Philipp Müller
d7862b927c omx: log commands as strings
Makes logs easier to read.
2013-03-15 09:29:56 +00:00
Tim-Philipp Müller
07e6ae99f1 omx: log states as strings 2013-03-15 09:29:55 +00:00
Tim-Philipp Müller
118345eef5 omx: log component name in debug messages
Useful when we have more different components
active at the same time.
2013-03-15 09:29:55 +00:00
Sebastian Dröge
67dc871116 omx: Reset some more buffer fields as required 2013-03-14 17:26:51 +01:00
Sebastian Dröge
5bab4a05f0 omx: The hack to disable usage of EOS buffers is not necessary anymore on RPi 2013-03-14 17:01:08 +01:00
Sebastian Dröge
ec687f1414 omx: Reset the flags for output ports when releasing a buffer, not for input ports 2013-03-14 17:00:42 +01:00
Sebastian Dröge
22dce51dd4 omx: Handle the OMX_EventBufferFlag to detect EOS too 2013-03-14 12:51:54 +01:00
Sebastian Dröge
acf15e84a9 omx: Mark OpenMAX buffers as EGLImage if they contain one
Needs special handling in some places, e.g. because nFilledLen
will always be 0.
2013-03-13 13:10:28 +01:00
Sebastian Dröge
303b6c4dc5 omx: Always load the OpenMAX IL cores with G_MODULE_BIND_LOCAL 2013-03-13 09:37:02 +01:00
Sebastian Dröge
f505dad87a omx: Lazy-load symbols of libbcm_host.so
It exports eglIntOpenMAXILDoneMarker(), which is also
exported by libopenmaxil.so... but we need the version
from libopenmaxil.so as the other one is just a stub.
2013-03-13 09:35:20 +01:00
Sebastian Dröge
b9bf849a39 omx: Log unknown events 2013-03-10 11:03:18 +01:00
Sebastian Dröge
716adfa5be Revert "omx: use no-component-reconfigure hack on the Raspberry PI"
This reverts commit e123b2089f.

It's not required anymore after the fix from the last commit.
2013-03-07 17:40:21 +01:00
Sebastian Dröge
20c9ae0823 omx: Also wait for disabled output ports to be reconfigured 2013-03-07 17:27:05 +01:00
Sebastian Dröge
7a1eaec3b9 omx: Add timeout to the flush operation and move buffer populating to a separate function 2013-03-07 13:57:00 +01:00
Sebastian Dröge
001b7f0ed9 omx: Remove min buffer count hack for RPi again
It's not necessary anymore
2013-03-07 13:56:50 +01:00
Sebastian Dröge
60861f3990 omx: Do number of buffers configuration explicitely 2013-03-07 13:56:44 +01:00
Josep Torra
e123b2089f omx: use no-component-reconfigure hack on the Raspberry PI 2013-03-07 11:02:39 +01:00