Commit graph

849 commits

Author SHA1 Message Date
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
Stefan Sauer
d0bb94ca63 Automatic update of common submodule
From f2c6b95 to bc76a8b
2015-01-12 16:13:35 +01:00
Sebastian Dröge
c77e7750e0 Automatic update of common submodule
From ef1ffdc to f2c6b95
2014-12-18 10:56:15 +01:00
Edward Hervey
248466f9f7 Automatic update of common submodule
From 7bb2bce to ef1ffdc
2014-11-27 17:12:42 +01: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
da68e6adbf Automatic update of common submodule
From 84d06cd to 7bb2bce
2014-10-27 18:00:50 +01:00
Tim-Philipp Müller
e87c46fd19 Automatic update of common submodule
From a8c8939 to 84d06cd
2014-10-21 13:03:44 +01:00
Stefan Sauer
bdd0c6e5f7 Automatic update of common submodule
From 1f5d3c3 to a8c8939
2014-10-21 13:00:10 +02:00
Sebastian Dröge
40ab1b0a45 omxaudiodec: Clean up code a bit to get rid of useless NULL checks 2014-09-30 10:47:20 +03:00
junji
eba9e3f29d omxaudiodec: Unmap input buffers after usage
https://bugzilla.gnome.org/show_bug.cgi?id=736314
2014-09-30 10:44:38 +03:00
Michal Lazo
bfeab29a39 omxvideoenc: Setup aspect ratio on RPi
Needs firmware from yesterday or newer to work with all possible
aspect ratios. Before that it only supported a fixed list.

https://bugzilla.gnome.org/show_bug.cgi?id=732533
2014-09-01 12:18:58 +03:00
Sebastian Dröge
cdb918aefb omxaudioenc: Implement the hack flag GST_OMX_HACK_NO_COMPONENT_RECONFIGURE 2014-08-28 10:45:37 +03:00
Sebastian Dröge
2c98a6ab7e omxaudioenc: Use the base class' open/close vfuncs instead of calling them ourselves 2014-08-28 10:45:37 +03:00
Peng Liu
d3d0a82ba4 omxvideoenc: Implement the hack flag GST_OMX_HACK_NO_COMPONENT_RECONFIGURE
Fix a video encoder stall problem on RPi when changing the aspect ratio.

https://bugzilla.gnome.org/show_bug.cgi?id=732533
2014-08-28 10:45:11 +03:00
Sebastian Dröge
d75334456d omx: Let base classes handle EOS
https://bugzilla.gnome.org//show_bug.cgi?id=734774
2014-08-14 17:36:11 +03:00
Sebastian Dröge
19d77004d2 omxaudiodec: Fix flushing logic and make it more similar to the video decoder 2014-08-14 17:33:07 +03:00
Sebastian Dröge
b4c7c726ef Release 1.2.0 2014-07-23 11:28:12 +02:00
Sebastian Dröge
41a7d37fe9 config: Update ranks to PRIMARY+1 to have higher preference than avdec_*
See https://bugzilla.gnome.org/show_bug.cgi?id=732161
2014-07-22 09:23:00 +02:00
Sebastian Dröge
c4deb7c07c omxaudiosink: Set port to not flushing in prepare() and keep it at flushing in unprepare()
https://bugzilla.gnome.org/show_bug.cgi?id=733168
2014-07-20 17:47:50 +02:00
Sebastian Dröge
08385fe944 omxaudiodec: Implement setting of fallback channel positions 2014-07-13 22:15:44 +02:00
Sebastian Dröge
03cf0bc9a4 omx: Add AAC audio decoder 2014-07-13 18:22:39 +02:00
Sebastian Dröge
f4961d0a72 omxaudiodec: Get PCM parameters from the out port, not the in port 2014-07-02 09:22:28 +02:00
Sebastian Dröge
c27053c94e omxaudiodec: Implement 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-07-02 09:21:00 +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
Sebastian Dröge
3d94d3e44d omx: Link to gmodule-2.0-no-export for being able to use the g_module_*() API
https://bugzilla.gnome.org/show_bug.cgi?id=732518
2014-07-01 09:38:01 +02:00
Sebastian Dröge
4d61049041 examples: #define GST_USE_UNSTABLE_API for libgstgl 2014-06-30 15:00:54 +02:00
Sebastian Dröge
33e083fff6 omxh264enc: Properly accumulate headers and push before the next frame
Fixes output of encoding on RPi, where each header buffer (SPS and PPS)
is in a separate OMX buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=726669
2014-06-29 19:10:19 +02:00
Sebastian Dröge
0a60770a28 omxvideoenc: Implement flush() instead of the deprecated reset() 2014-06-29 19:04:54 +02:00
Sebastian Dröge
d08002841b rpi: It's 44100Hz, not 41400Hz 2014-06-25 17:14:41 +02:00
Julien Isorce
961b108a92 configure.ac: require gstgl >= 1.3.3 2014-06-25 11:12:51 +01:00
Julien Isorce
e1a1e5f335 example: enable testegl
See https://bugzilla.gnome.org/show_bug.cgi?id=728940
2014-06-25 10:50:54 +01:00
Julien Isorce
3d0b891e42 testegl: do matrix mutlplication in the shader
See https://bugzilla.gnome.org/show_bug.cgi?id=728940
2014-06-25 10:50:54 +01:00
Julien Isorce
91c6e34217 testegl: add a comment for the parse command
See https://bugzilla.gnome.org/show_bug.cgi?id=728940
2014-06-25 10:50:54 +01:00
Julien Isorce
31cd1fd77b testegl: convert code from GLESv1 to GLESv2
See https://bugzilla.gnome.org/show_bug.cgi?id=728940
2014-06-25 10:50:54 +01:00
Julien Isorce
f1c76ef921 testegl: port to gstgl API
- append a glfilter just before fakesink
  So that we get gltexture or eglimages

- propagate our EGLDisplay to the pipeline
  see GST_QUERY_CONTEXT

- share our EGLContext with the iternal gl context
  of the pipeline, see GST_QUERY_ALLOCATION

- use GstVideoGLTextureUploadMeta to upload
  the incoming gltexture or eglimage to our gl texture

TODO: convert from GLESv1 to GLESv2

See https://bugzilla.gnome.org/show_bug.cgi?id=728940
2014-06-25 10:50:54 +01:00
Sebastian Dröge
4593f434a0 omxbufferpool: Copy buffers if the stride does not match and we can't use video meta
https://bugzilla.gnome.org/show_bug.cgi?id=731672
2014-06-24 15:11:53 +02:00
Sebastian Dröge
b9238195dd omx: Only include OMX_VideoExt.h conditionally
It does not exist on the RPi for example.
2014-06-24 14:52:43 +02:00
Sebastian Dröge
c0183cc313 configure.ac: Require GStreamer core/base >= 1.2.2
Needed at least for gst_video_decoder_release_frame().
2014-06-24 13:59:44 +02:00
Sebastian Dröge
af38fe7dce omxbufferpool: Fix format string compiler warning 2014-06-24 13:02:13 +02:00
Michal Lazo
326e15ca85 omxbufferpool: Initialize debug category 2014-06-24 13:01:48 +02:00
Sebastian Dröge
03c54e7c0f omxbufferpool: Properly convert OMX alignment to GStreamer alignment
GStreamer uses a bitmask for the alignment while OMX uses the
alignment itself. Let's convert.

https://bugzilla.gnome.org/show_bug.cgi?id=710564
2014-06-24 12:42:22 +02:00
Sebastian Dröge
6617d6f577 omxh264enc: Don't let baseclass finish frames for SPS/PPS buffers
Otherwise we a) send them twice, and b) finish a frame for something
that does not even include a frame.

https://bugzilla.gnome.org/show_bug.cgi?id=726669
2014-06-24 11:11:28 +02:00
Sebastian Dröge
b496a6d6f2 omxvideo: Include the separate headers too for compatibility with 1.0.x 2014-06-24 10:22:37 +02:00
Zhao, Halley
38a07c5386 omxvp8dec: use VP8 definition from OMX_VideoExt.h
https://bugzilla.gnome.org/show_bug.cgi?id=726957
2014-06-24 10:21:07 +02:00
Zhao, Halley
0b2f5791f0 configure: add --with-omx-header-path option for external omx headers
https://bugzilla.gnome.org/show_bug.cgi?id=726957
2014-06-24 10:20:09 +02:00
Aurélien Zanelli
58aa603b36 omxvideodec: fix a query leak
Also add a debug message if query fails.

https://bugzilla.gnome.org/show_bug.cgi?id=731898
2014-06-20 11:54:25 +02:00
Aurélien Zanelli
ad969ffda3 omxvideodec: release frames with old PTS to avoid memory issue
Interlaced stream could make the decoder use two input frames to produce
one output frame causing the gstvideodecoder frame list to grow.
Assuming the video decoder output frame in display order rather than in
decoding order, this commit add a way to release frames with PTS less
than current output frame.

https://bugzilla.gnome.org/show_bug.cgi?id=730995
2014-06-04 16:36:02 +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
Aurélien Zanelli
3ed713db0d omxvideodec: add missing stream unlock in error path 2014-06-02 19:28:51 +02:00