Commit graph

1527 commits

Author SHA1 Message Date
Peter Seiderer
f160625ea6 v4l2src: device sequence/offset correction in case of renegotiation
The v4l2 device restarts the sequence counter in case of streamoff/streamon,
the GST offset values are supposed to increment strictly monotonic, so
adjust the sequence counter/offset values in case of caps
renegotiation.

https://bugzilla.gnome.org/show_bug.cgi?id=745441
2015-04-02 17:40:20 -04:00
Peter Seiderer
866d97fa2c v4l2src: add frame loss detection
In case of v4l2 driver filled offset/sequence values add frame
loss detection (and write a warning message).

Move offset meta data setting and frame loss checking after the
timestamp adjustment code to get proper timestamps for the
warning message.

https://bugzilla.gnome.org/show_bug.cgi?id=745441
2015-04-02 17:40:19 -04:00
Peter Seiderer
f16fe891fb v4l2: use v4l2 capture device sequence counter
Use the v4l2 capture device sequence counter for
setting the GstBuffer offset/offset_end values.

https://bugzilla.gnome.org/show_bug.cgi?id=745441
2015-04-02 17:40:19 -04:00
Tobias Modschiedler
8390288a6e v4l2: Ask the driver about its requirements for min_buffers before initiating buffer pool.
If propose_allocation() had not been called yet, it was possible that the driver was not asked at all.
In buffer pool: Consider minimum number of buffers requested by driver when setting config.

https://bugzilla.gnome.org/show_bug.cgi?id=746834
2015-04-02 17:29:19 -04:00
Julien Isorce
d63c163335 osxvideosink: check for deprecated constants prior to OSX 10.10
cocoawindow.m:339:5: error: 'NSOpenGLPFAWindow'
is deprecated: first deprecated in OS X 10.9

cocoawindow.m:576:7: error: 'NSOpenGLPFAFullScreen'
is deprecated: first deprecated in OS X 10.6

cocoawindow.m:605:24: error: 'setFullScreen'
is deprecated: first deprecated in OS X 10.7
2015-03-24 23:16:26 +00:00
Ilya Konstantinov
6af516b21f osxaudio: Fix string format warning on 32-bit
UInt32 (Darwin, not C99's uint32_t) is 'unsigned long' on 32-bit
platforms.
2015-03-23 19:48:43 +05:30
Thiago Santos
0a945e7099 v4l2src: delay renegotiation until it is likely buffers were reclaimed
Allow renegotiation to happen when buffers have returned after an allocation
query. As the allocation query is serialized, all buffers from the pool
should have returned and we can stop it to create a new one for the
new format

https://bugzilla.gnome.org/show_bug.cgi?id=682770
2015-03-13 18:48:03 +00:00
Thiago Santos
6cfa6c0da8 v4l2object: add gst_v4l2_object_try_format
Similar to set_format but it uses TRY_FMT instead of S_FMT

https://bugzilla.gnome.org/show_bug.cgi?id=682770
2015-03-13 18:47:55 +00:00
Jan Schmidt
c809bcd394 Remove a couple of superfluous trailing semi-colons 2015-03-12 01:37:08 +11:00
Tim-Philipp Müller
c4fa54da17 Fix double semicolons 2015-03-10 09:31:20 +00:00
Ilya Konstantinov
b528c527b7 osxaudio: stream format is an SPDIF-only field 2015-03-10 09:14:57 +05:30
Ilya Konstantinov
7b365042f0 osxaudio: fix spaces 2015-03-10 09:14:57 +05:30
Ilya Konstantinov
8f62f50a98 osxaudio: add type check macro 2015-03-10 09:14:57 +05:30
Ilya Konstantinov
d450b1cac1 osxaudio: rename gst_core_audio_set_channels_layout()
to gst_core_audio_get_channel_layout().
2015-03-10 09:14:57 +05:30
Ilya Konstantinov
4637b3eb82 osxaudio: remove unused finalize 2015-03-10 09:14:57 +05:30
Nicolas Dufresne
eeb4d2e8b1 v4l2bufferpool: Don't update buffer for OUTPUT
For output device, we should not update the buffer with flags and
timestamp when we dequeue. The information in the v4l2_buffer is not
meaningful and it breaks the case where the buffer is rendered at
multiple places.

https://bugzilla.gnome.org/show_bug.cgi?id=745438
2015-03-08 21:15:53 +00:00
Thiago Santos
c194f2de12 directsoundsink: fix modulo math with ringbuffer parameters
To get a multiple of bpf use a subtraction and not an addition

https://bugzilla.gnome.org/show_bug.cgi?id=745684
2015-03-06 11:27:41 -03:00
Arun Raghavan
995ba701b7 osxaudiosrc: Allow caps renegotiation
The ringbuffer does allow renegotiation, so we do not have to report
fixed caps once it is acquired (based on a similar patch for the sink
side by Ilya Konstantinov <ilya.konstantinov@gmail.com>).
2015-03-03 23:26:58 +05:30
Ilya Konstantinov
fd25ef137e osxaudiosink: Allow renegotiating caps
Once osxaudiosink's device is open, it fixates on the initial caps and
refuses to accept new caps. This is erroneous since the Audio Unit is
can accept a new ASBD, and GstAudioRingBuffer supports reconfiguration
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=743925
2015-03-03 23:26:58 +05:30
Gwenole Beauchesne
8cd40e77b7 v4l2allocator: fix fd leak in DMABUF import mode.
Ensure gst_v4l2_buffer_pool_release_buffer() releases the associated
GstV4l2MemoryGroup. In particular, this allows for closing the DMABUF
handles prior to instantiating new ones.

https://bugzilla.gnome.org/show_bug.cgi?id=745443
2015-03-02 15:10:51 -05:00
Nicolas Dufresne
8e75acc7b7 v4l2bufferpool: Add missing break
This is cosmetic change.
2015-03-01 14:03:04 -05:00
Nicolas Dufresne
76775efe71 v4l2: Workaround driver not setting field correctly
As it's very common, handle driver not setting field in buffers
by using the field value from the format. This workaround a long time
bug in UVC driver. For even buggier driver, we simply assume
progressive as before. We also only warn once, to avoid spamming.
2015-03-01 14:03:04 -05:00
Aurélien Zanelli
88703ae585 v4l2: query crop configuration after each call of S_CROP
S_CROP ioctl is write-only and the device can adjust crop rectangle so
we query back the crop configuration after each S_CROP to know what has
been done.

https://bugzilla.gnome.org/show_bug.cgi?id=736133
2015-02-26 08:38:32 -05:00
Aleix Conchillo Flaqué
63746c4131 v4l2bufferpool: Check corruption flag on the right buffer
We where checking the buffer we are copying to instead of the buffer we
are copying from.

https://bugzilla.gnome.org/show_bug.cgi?id=740040
2015-02-25 20:53:19 -05:00
Aurélien Zanelli
7a1613b9e1 v4l2object: set colorspace in caps for capture devices
This information is set by the driver for a capture device, and so could
be forwarded to pipeline by setting the colorimetry in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=743186
2015-02-25 14:48:20 -05:00
Aurélien Zanelli
600027a1ee v4l2bufferpool: fix import_userptr() in single-planar API when n_planes > 1
In the V4L2 single-planar API, when format is semi-planar/planar,
drivers expect the planes to be contiguous in memory.
So this commit change the way we handle semi-planar/planar format
(n_planes > 1) when we use the single-planar API (group->n_mem == 1).

To check that planes are contiguous and have expected size, ie: no
padding. We test the fact that plane 'i' start address + plane 'i'
expected size equals to plane 'i + 1' start address. If not, we return
in error.

Math are done in bufferpool rather than in allocator because the
former is aware of video info.

https://bugzilla.gnome.org/show_bug.cgi?id=738013
2015-02-25 14:25:01 -05:00
Aurélien Zanelli
ac3cb8817e v4l2allocator: let bufferpool calculate image size when importing userptr
Offset are relative to the buffer and there is no guarantee substracting
them will give us the plane size. So we let bufferpool make the math as
it is more aware of video info than allocator and pass a size array to
allocator import function.

Pointed out by Nicolas Dufresne <nicolas.dufresne@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=738013
2015-02-25 14:24:49 -05:00
Philippe De Muyter
61a5e5af95 v4l2object: recognize and distinguish all bayer arrangements
Up to now, v4l2src recognized only "bggr" amongst the bayer arrangements.
Recognize now also the "rggb", "gbrg" and "grbg" arrangements.

https://bugzilla.gnome.org/show_bug.cgi?id=742363
2015-02-25 14:14:59 -05:00
Aurélien Zanelli
e57bc43862 v4l2bufferpool: set v4l2_buffer.field when queuing buffer in an output device
According to the current specification, application must set this field
for an output device.

https://bugzilla.gnome.org/show_bug.cgi?id=743013
2015-02-25 10:27:30 -05:00
Ilya Konstantinov
8ca40fa86f osxaudiosrc: iOS resampling causes stuttering
Fixes stuttering audio when iOS AU is resampling. To make AU resample,
one has to request a rate that differs from AVAudioSession's
sampleRate. The resampling itself is not the culprit, but rather our
API misuse.

AudioUnitRender modifies the mDataByteSize members with the
actual read bytes count. Therefore, they must be reinitialized
before each AudioUnitRender. (The buffers themselves can be
preallocated.)

The "stutter" was caused by one AudioUnitRender making the buffer
too small for other AudioUnitRender invocations, making them fail
with -50 (paramErr). By way of luck, when AU didn't resample, all
AudioUnitRender invocations read the same number of bytes.

(This patch addresses some non-interleaved audio concerns, but
at this moment the elements do not support non-interleaved audio
and non-interleaved is untested.)

https://bugzilla.gnome.org/show_bug.cgi?id=744922
2015-02-24 16:21:11 +05:30
Tim-Philipp Müller
ba0eeaf8f4 ximagesrc: remove pointless g_return_val_if_fail()
ximage won't ever be NULL here because the dispose
function is called via ximage->dispose().
2015-02-23 20:06:25 +00:00
Nicolas Dufresne
6afd1c5d57 v4l2: Enable copy when no known allocation params
When there is no allocation parameters in the query, enable copy
threshold. When this threshold is reached, the buffer pool will start
copying when the pool reaches a critical level. If the driver supports
CREATE_BUFS, this will be used instead.
2015-02-19 23:16:00 -05:00
Nicolas Dufresne
dfb0ec6d4d v4l2bufferpool: Update allocator flags
When we hit emulated formats, we disable CREATE_BUFS since libv4l2
cope very badly with it. Also clear the allocator flags so we will
never try to allocate more buffers. This fixes failure when the copy
threshold is reached as we where calling CREATE_BUFS, which lead to
libv4l2 instability.
2015-02-19 23:16:00 -05:00
Nicolas Dufresne
7dc475f141 v4l2bufferpool: Use specific debug category
The pool has grown enough that it is now handy to seperate v4l2object
trace from v4l2bufferpool trace.
2015-02-19 23:16:00 -05:00
Luis de Bethencourt
7ca7b1cd9a Revert "v4l2: fraction is reversed"
This reverts commit b91fe36644.
2015-02-18 19:18:00 +00:00
Luis de Bethencourt
b91fe36644 v4l2: fraction is reversed
In the fraction 1 / 2. 1 is the numerator and 2 is the denominator.
The arguments of fraction gst_value_set_fractions() are value,
numerator and denominator.
Also, gst_value_set_fraction() fails if denominator is 0 for obvious
reasons.
2015-02-18 17:49:31 +00:00
Nicolas Dufresne
171bfeccdf v4l2pool: Deactivate other pool
When importing buffers from a downstream pool, we need to deactivate
that pool to ensure it will be usable again later. Relying on the
refcount to reach zero does not work, since elements like xvimagesink
keeps a reference on their proposed pool.
2015-02-18 09:05:37 -05:00
Nicolas Dufresne
f5ef99fe5e v4l2allocator: Fix freeing of shared memory
When memory (that has been shared using gst_memory_share()) are freed,
the memory (or the DMABUF FD) should not bee freed. These memories have
a parent. This also removes the extra _v4l2mem_free function and avoid
calling close twice on the DMABUF FD.

https://bugzilla.gnome.org/show_bug.cgi?id=744573
2015-02-15 16:21:55 -05:00
Peter Seiderer
c88e042458 v4l2object: reuse caps framerate if not overwritten by v4l2 device
Enables duration setting in v4l2src.

https://bugzilla.gnome.org/show_bug.cgi?id=740403
2015-01-22 18:52:44 -05:00
Nicolas Dufresne
f3f4bdd676 v4l2videodec: Proxy getcaps
Replace the sink_query with new getcaps() virtual and use the proxy
helper with the probed caps. This allow upstream element taking decision
base on what is supported downstream.
2015-01-13 16:55:43 -05:00
Sebastian Dröge
81e15d22c0 osxvideosink: Disable hack for NSApp iteration with a special #define
The hack causes deadlocks and other interesting problems and it really
can only be fixed properly inside GLib. We will include a patch for
GLib in our builds for now that handles this, and hopefully at some
point GLib will also merge a proper solution.

A proper solution would first require to refactor the polling in
GMainContext to only provide a single fd, e.g. via epoll/kqueue
or a thread like the one added by our patch. Then this single
fd could be retrieved from the GMainContext and directly integrated
into a NSRunLoop.

https://bugzilla.gnome.org/show_bug.cgi?id=741450
https://bugzilla.gnome.org/show_bug.cgi?id=704374
2015-01-10 15:54:22 +01:00
Nicolas Dufresne
5c67ba7f88 v4l2videodec: Prevent renegotiation
Renegotiation isn't supported, simply prevent it the way we do in
v4l2src.
2015-01-09 16:59:53 -05:00
Nicolas Dufresne
c4aaff5c92 v4l2videodec: Don't unlock the stream lock twice 2015-01-09 16:55:55 -05:00
Nicolas Dufresne
f7c682f802 v4l2allocator: Add protection against driver bug
v4l2loopback driver has a this nasty bug that if the queue is larger
then 2 buffers, it returns random index on dqbuf. So far we assumed
that the index was always right, which would lead to memory being
unref twice, and eventually crash.
2015-01-08 23:55:28 -05:00
Nicolas Dufresne
3e876215b7 v4l2: Don't use allocator size to iterate
As the buffer array is fixed size and small, it's safer to simply
use this static size to cleanup the buffers. This is also more
consistent with the rest. The associated method is no longer
required and can be dropped.
2015-01-08 23:55:28 -05:00
Nicolas Dufresne
e47a5708f0 v4l2bufferpool: Don't clean buffer array in dispose
This should already have been done, plus this code is incorrect
and may lead to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=742074
2015-01-08 23:55:28 -05:00
Nicolas Dufresne
bbcfd594e4 v4l2bufferpool: Don't ref queued output buffer
This partly revert to the old 1.2 behavior. Instead of keeping a
reference to the output buffer queued, we simply release them but
don't forward it to GstBufferPool. This way, the buffer pool don't
need to be flushed to be stopped.

https://bugzilla.gnome.org/show_bug.cgi?id=742074
2015-01-08 23:55:28 -05:00
Nicolas Dufresne
a4b961e275 v4l2bufferpool: Never fail on streamoff
Failing streamoff prevents allocator from being disposed hence
lead to device FD leak. There is no known cases where streamoff
may fails for which we'd still be streaming. streamoff is known
to fail when a device is being unplugged (in which case errno
19/ENODEV is set).

https://bugzilla.gnome.org/show_bug.cgi?id=732734
2015-01-08 11:37:23 -05:00
Sebastian Dröge
11d6be2dcb osxaudio: Directly return the ringbuffer's caps if it is acquired 2014-12-22 15:33:51 +01:00
Sebastian Dröge
fc1670b75d osxaudio: Put all audio formats into the template caps
We report the proper caps later from the get_caps() vfunc implementation after
probing the selected device.
2014-12-22 12:56:19 +01:00