Commit graph

242 commits

Author SHA1 Message Date
Matthew Waters 989200820d glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2016-06-29 18:04:28 +10:00
Xavier Claessens 26b66a1db5 ahcsrc: Avoid a div by 0 warning
https://bugzilla.gnome.org/show_bug.cgi?id=767302
2016-06-06 21:19:33 +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
Tim-Philipp Müller 889a1a9b90 androidmedia: fix error debug message when camera doesn't exist
Makes no sense to include the system error here since errno
will likely not be set and then it says 'system error: success'
which is confusing.

https://bugzilla.gnome.org/show_bug.cgi?id=767087
2016-05-31 20:41:14 +01:00
Justin Kim fe62233b83 ahcsrc: release resources in 'finalize' function
In general, 'dispose' function is used for dropping all references
and 'finalize' is called for releasing instances.

https://bugzilla.gnome.org/show_bug.cgi?id=763309
2016-05-31 12:58:06 +01:00
Martin Kelly 8c236a9f2e ahc: fix potential NULL deref
This bug was found via cppcheck static analysis.

If android.hardware.Camera.getParameters returns NULL, then object will
be NULL, and we won't allocate params. This means that the GST_DEBUG
statement referencing params->object will be invalid. Fix this by
exiting early if android.hardware.Camera.getParameters returns NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=766638
2016-05-20 09:16:28 +03:00
Martin Kelly 537ba5d109 ahc: fix typo in doc blurb
https://bugzilla.gnome.org/show_bug.cgi?id=766679
2016-05-19 20:47:58 +01:00
Sebastian Dröge 00d961a839 amcaudiodec: Set layout=interleaved in raw audio caps
Otherwise the GAP event fallback negotiation will fail to produce complete
srcpad caps, and thus fail.

https://bugzilla.gnome.org/show_bug.cgi?id=766289
2016-05-11 23:49:36 +03:00
Justin Kim c8e34e93b2 androidmeida: replace with new surfacetexture for ahcsrc
GstAmcSurfaceTexture is more clear and simple than GstAGSurfaceTexture.

https://bugzilla.gnome.org/show_bug.cgi?id=763099
2016-05-06 09:18:00 +03:00
Sebastian Dröge 5d9df5d5d0 ahcsrc: There's no point in read-only CONSTRUCT properties
And creating one is causing assertions. Also get rid of the other CONSTRUCT
property as it's a) unneeded for default initialization and b) you're not
supposed to use constructor properties when creating element instances and the
GStreamer API doesn't provide direct ways for doing so.

https://bugzilla.gnome.org/show_bug.cgi?id=764339
2016-03-30 10:35:53 +03:00
Martin Kelly d6a17cd3cc ahc: use g_slice_new instead of g_slice_new0
In many cases, we use g_slice_new0 and then immediately overwrite the
allocated memory. This is inefficient. Since we're going to immediately
overwrite it, we might as well use plain g_slice_new.

https://bugzilla.gnome.org/show_bug.cgi?id=763998
2016-03-24 14:59:42 +02:00
Justin Kim b9ecc42b76 ahcsrc: remove probe_properties
It's a residue of 0.10.

https://bugzilla.gnome.org/show_bug.cgi?id=763100
2016-03-24 14:57:39 +02:00
Vineeth TM 8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Martin Kelly c257829213 ahc: eliminate AHC*_CALL macros
Currently, we use AHC*_CALL macros to call many of the Camera functions.
However, we already have helper classes to call the Camera functions, so
eliminate the macros.

As a nice side-benefit, we also get improved error handling and
reporting when something goes wrong calling these functions, because a
GError gets populated, and we log a GST_ERROR when something fails. This
was harder to do using macros, as all error handling was hidden from the
caller.

https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-24 14:55:14 +02:00
Martin Kelly a2f270b316 ahc: use gst unref functions
https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-24 14:55:14 +02:00
Martin Kelly 1bfd6526d4 ahc: use gst new object functions
https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-24 14:55:14 +02: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 9132b72c32 amcvideodec: getOutputBuffers() returns a NULL array when a surface was configured
So don't error out if it does.

https://bugzilla.gnome.org/show_bug.cgi?id=763401
2016-03-11 10:46:10 +02:00
Justin Kim 10c6d1b558 androidmedia: Remove unused file
ahcsrc is registered by gstamc.c

https://bugzilla.gnome.org/show_bug.cgi?id=763098
2016-03-05 10:04:39 +02:00
Martin Kelly a7d6c07b86 amc: properly deinit when ahcsrc register fails
In the androidmedia plugin_init, we initialize various resources on the
Android device. If anything fails during this series of initializations,
we need to deinitialize any initializations that already occurred.
However, we don't do so if we fail to register the ahcsrc element. Fix
this.

https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-04 09:42:14 +02:00
Martin Kelly ddebf1ff66 ahc: correct error message
The error message is specific to only one of the failure cases and is
misleading in the others. Correct it to be more generic and cover all
the failure cases.

https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-04 09:42:14 +02:00
Martin Kelly e337918a06 ahc: remove unneeded #include <stdio.h>
https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-04 09:42:14 +02:00
Martin Kelly 21d1eaa6c8 ahc: typo fix
https://bugzilla.gnome.org/show_bug.cgi?id=763065
2016-03-04 09:42:14 +02:00
Sebastian Dröge 476d5b6940 amcvideodec: When outputting on a surface, accept all color formats
We don't have to understand them, we handle them as a GL texture.

https://bugzilla.gnome.org/show_bug.cgi?id=762792
2016-02-28 11:10:39 +02:00
Matthew Waters cd4a93da3b glsyncmeta: separate out gpu/cpu waits.
CPU waits are more expensive and are only required if the CPU is ever going to
access the data. GPU waits perform inter-context synchronisation and are cheaper
as they don't require CPU intervention.
2016-02-09 12:30:25 +11:00
Matthew Waters 9efdfb1a29 amcvideodec: pass the correct time value to wait_for_sync
When we are not waiting, we need to pass -1 to signal that we just want to check
that the frame was/n't rendered.  Avoids waiting for frames that will never be
rendered.

https://bugzilla.gnome.org/show_bug.cgi?id=761014
2016-02-04 15:46:22 +11:00
Matthew Waters 3c29dcaddb amcvideodec: advance the ready counter ourselves when render=FALSE
When not rendering the video frame, e.g. when freeing an unreleased sync frame,
we will not receive a frame listener callback.

Reduces the amount of 'on_frame_available miss detected' messages when dropping
frames.

https://bugzilla.gnome.org/show_bug.cgi?id=761014
2016-02-04 15:46:22 +11:00
Matthew Waters b276de7827 amcvideodec: guard against not finding a valid frame in loop
Fixes sporadic crashes on finishing decoding a video.

https://bugzilla.gnome.org/show_bug.cgi?id=761014
2016-01-29 23:52:15 +11:00
Matthew Waters 1fceac8122 amcvideodec: set our data pointer in java to NULL on close
The frame available callback can be called after deconfiguring the amc codec.
Guard against this by setting the back pointer to NULL on close() and ignoring
any NULL data pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=761014
2016-01-29 23:52:15 +11:00
Sebastian Dröge c9d9042aff ahc: Fail gracefully if our callback class can't be found
Instead of just ignoring that error and then calling JNI functions with NULL,
which will kill the virtual machine.

The error handling here needs some further improvements though, errors in more
places are just ignored.
2016-01-22 17:25:28 +02:00
Sebastian Dröge 551b0a5f28 ahc: Initialize GError pointer with NULL
Otherwise there will be assertions.
2016-01-22 17:22:47 +02:00
Sebastian Dröge f585a66bd1 amcvideodec: Only free GstAmcBuffer if it's not NULL
And also free it on GL errors.
2016-01-22 17:19:29 +02:00
Sebastian Dröge 8c57341241 amc: Add an assertion for NULL GErrors
Should never happen! But an assertion is better than a NULL pointer
dereference.
2016-01-22 16:22:25 +02:00
Sebastian Dröge 31e1b7ceeb ahc: Fix indentation 2016-01-22 16:14:46 +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
Nicolas Dufresne 09dbc5b298 ahcsrc: Fix latency reporting
Currently it was wrongly reporting min/max as being the shortest and
longest possible frame duration. This is not how latency works in
GStreamer.

Fix by reporting min latency as being the longest possible duration of
one frame. As we don't know how many buffers the stack can accumulate, we
simply assume that max latency is the same (the usual default behaviour).
2016-01-21 13:49:18 -05:00
George Kiagiadakis 9a53d79876 ahcsrc: fix deadlock when flushing
_data_queue_item_free() calls gst_buffer_unref(), which
calls gst_ahc_src_buffer_free_func(), which calls
g_mutex_lock() on self->mutex and there you go... deadlock!
2016-01-21 13:49:18 -05:00
Justin Kim f1809c4d93 ahcsrc: porting from 0.10 to 1.0 2016-01-21 13:49:17 -05:00
Justin Kim becaf2852d move androidcamera into androidmedia
This commit is a part of portng android hardware camera from 0.10 implementation.
To preserve history and get diff clearly, the interesting files are moved to
deployment directory and the remaining files are removed.
2016-01-21 13:49:17 -05:00
Youness Alaoui c84878ad4b androidmedia: Fix get_level and get_profile exception checking by not using return 2016-01-21 13:49:17 -05:00
Youness Alaoui 86f2535c41 androidmedia: Add extern gint declarations 2016-01-21 13:49:16 -05:00
Sebastian Dröge 64b869ea40 dvm: Rename gst-dvm.[ch] to gstdvm.[ch] for consistency with other GStreamer code 2016-01-21 13:49:15 -05:00
Sebastian Dröge e3801c041f androidmedia: Make everything compile with the new wrappers 2016-01-21 13:49:15 -05:00
Sebastian Dröge ade8590778 androidmedia: Add remaining bits of the Java wrappers using libgstdvm 2016-01-21 13:49:15 -05:00
Sebastian Dröge ea43e42ca5 androidmedia: Remove g_return_if_fails()
This is not public API so it has no advantage to have them here.
2016-01-21 13:49:14 -05:00
Youness Alaoui 3ac90867ac androidmedia: Use gst-dvm and refactor java wrappers (WIP)
Moved the java wrapper API into its own files and made use of the
gst-dvm macros. Also renamed the API to have the proper naming
convention and coding style in order to match the one in androidcamera.
This is a work in progress! "android/media/MediaCodecList" is still missing
and the actual elements have not been ported to use the new function names.
2016-01-21 13:49:14 -05:00
Matthew Waters 650e5c4fe5 glmemory: implement GstGLBaseMemory::alloc
- Create GstGLVideoAllocationParams which is a GstGLAllocationParams subclass.
- Make it possible to allocate glmemory objects directly if no frills are
  needed.
2015-12-17 13:49:55 +11:00
Matthew Waters fd3203cfeb amcvideodec: update for GLMemory API changes 2015-12-14 19:15:14 +11:00
Mathias Hasselmann d387bfd188 androidmedia: Don't add metadata to locked buffer
The video decoders tried calling gst_buffer_add_*meta() on non-writable
buffer resulting in warnings of this kind:

  gstamcvideodec.c:921 (_gl_sync_render_unlocked): WARNING: amcvideodec
  Failed to create the transformation meta for the gl_sync 0xabc03848
  buffer 0xabb01b40 (0)

https://bugzilla.gnome.org/show_bug.cgi?id=758694
2015-11-26 22:24:26 +11:00
Matthew Waters ab3fd36d64 amcvideodec: move release_output_buffer into the sync meta
Some devices only ever keep one buffer available in the GL queue resulting in
multiple calls to release_output_buffer only causing one frame to be rendered.
If there is a queue after amcvideodec (even playsink's small one), then
multiple buffers are pushed but only a small fraction of them are actually
rendered on time.  The rest will either render some number of frames ahead of
where they are meant to be or timeout waiting for a frame that's already been
rendered.

Solved by moving the release_output_buffer into the sync_meta the is pushed
downstream.  When downstream renders, the custom sync implementation attempts
to release the current buffer (if not already released) and render. Once the
frame has been rendered to the screen, the next frame is released and is
hopefully available by the time the next frame is to be rendered.

This fixes a perceived frame jitter in the output.
2015-11-19 19:25:48 +11:00