Commit graph

267 commits

Author SHA1 Message Date
Ilya Konstantinov
29c79d7595 vtenc: always enqueue frames, even on error
Even when we fail to encode frame, we should still enqueue it so
it could be passed into handle_frame (with output_buffer == NULL).
Otherwise, we risk GstVideoEncoder's queue of frames growing unbounded.

Note: We're slightly changing the renegotiation code to accommodate for
frames without output buffers, but this commit takes no ownership over
the way negotiation is being done.

https://bugzilla.gnome.org/show_bug.cgi?id=750669
2015-06-10 22:23:06 +02:00
Ilya Konstantinov
6101fc57b8 vtenc: free input buffer ASAP
VTCompressionSessionEncodeFrame retains the CVPixelBuffer during
encoding, and will release it as soon as it can (e.g. before it even
calls our callback). This means we can safely release input buffer
at this point, possibly allowing the system to reuse it sooner.

https://bugzilla.gnome.org/show_bug.cgi?id=750671
2015-06-10 10:30:23 +02:00
Ilya Konstantinov
f5c29c7379 vtenc: Add missing gst_vtenc_frame_free() in error path
https://bugzilla.gnome.org/show_bug.cgi?id=750668
2015-06-10 10:26:28 +02:00
Ilya Konstantinov
5db08a8b89 vtenc: add alignment=au to sink caps
VT compression callback gets a CMSampleBuffer per frame, so vtenc_h264
should set 'alignment=au' in sink caps to indicate this.

https://bugzilla.gnome.org/show_bug.cgi?id=750635
2015-06-10 10:20:44 +02:00
Ilya Konstantinov
05cc418ca2 avfassetsrc: fix huge memory leak
CMSampleBuffers were retained -> huge memory leak.

https://bugzilla.gnome.org/show_bug.cgi?id=750638
2015-06-09 16:36:41 +02:00
Ilya Konstantinov
faf903720a vtenc: no need for queue_length with try_pop 2015-06-09 16:20:06 +02:00
Ilya Konstantinov
1f7681dd0a vtdec: don't copy meta from input to output
Copying arbitrary metas is going to cause problems and this should really be
handled by the base class. It overrides most other things already anyway,
including timestamp and duration. Those are just set here now so we can
insert the frame sorted into the queue.

https://bugzilla.gnome.org/show_bug.cgi?id=748922
2015-06-09 16:20:06 +02:00
Thiago Santos
045bfa10fe Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2015-06-05 09:43:35 -03:00
Nicolas Dufresne
4cca6efda8 vtdec: Require width and height field for H264
This decoder does not work if width and height field are not set
in the sinkpad caps. Let's make this explicit by adding them to
the template caps.

https://bugzilla.gnome.org/show_bug.cgi?id=749655
2015-06-01 11:23:41 -04:00
Ilya Konstantinov
94e7ed1323 vtenc: fix keyframe request race condition
It is incorrect to modify the frame properties after passing them, since
VTCompressionSessionEncodeFrame takes reference and we have no control
over when it's being used.

In fact, the code can be simplified. We just preallocate the frame
properties for keyframe requests, and pass NULL otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=748467
2015-06-01 13:32:03 +02:00
Ilya Konstantinov
c948484c7f avfvideosrc: fix unconditional buffer queue unlock
Unless stopRequest is set, we should unlock conditionally -- otherwise,
the 'create:' method can wake up to an empty buffer queue
and pull a nil buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=748054
2015-05-11 21:11:30 +10:00
Sebastian Dröge
7020154f1c vtdec: We shouldn't manually check reconfigure flag on pads but instead implement ::negotiate()
Add FIXME comment related to that.
2015-05-08 15:08:18 +02:00
Ilya Konstantinov
528871f571 avfvideosrc: drop frames we get before we have a clock
https://bugzilla.gnome.org/show_bug.cgi?id=748054
2015-04-26 20:37:11 +02:00
Yujin Lee
a8ea7a9cfb vtdec: fix build error with clang
This commit fixes a simple build error by clang with
by clang with [-Werror,-Wtautological-pointer-compare] options.

https://bugzilla.gnome.org/show_bug.cgi?id=748110
2015-04-26 19:23:06 +02:00
Alessandro Decina
edf9035d02 applemedia: avoid implicit color conversions
Rework the GL texture code a little to avoid implicit color conversion inside
AVF/VT on both iOS and OSX.
2015-04-20 17:09:58 +10:00
Ilya Konstantinov
c98eb6f2f5 corevideotexturecache: free texture cache on iOS
https://bugzilla.gnome.org/show_bug.cgi?id=748122
2015-04-19 14:48:43 +02:00
Ilya Konstantinov
472d1959a2 avfvideosrc: check for failure to create buffer
gst_core_media_buffer_new and gst_core_video_texture_cache_get_gl_buffer
can fail for various platform reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=748122
2015-04-19 14:48:11 +02:00
Yujin Lee
4a88951c52 avfvideosrc: fix build failure with clang
Use fabs for floating point input.

https://bugzilla.gnome.org/show_bug.cgi?id=748128
2015-04-19 12:54:32 +01:00
Ilya Konstantinov
a02a948a5d avfvideosrc: get connection and input clock early 2015-04-18 00:33:42 +10:00
Ilya Konstantinov
d1120c591c avfvideosrc: remove unused variables
Complement commit 5496fd3e75 by removing
the involved variables.
2015-04-15 10:16:17 +10:00
Alessandro Decina
a10232f7da applemedia: vtdec: fix GL negotiation 2015-04-14 20:33:25 +10:00
Alessandro Decina
3e0391a1f1 avfvideosrc: log timestamps 2015-04-14 18:05:58 +10:00
Ilya Konstantinov
5bc17dac29 avfvideosrc: subtract time spent in AVF queues
The time spent in AVF queues was being incorrectly added to running time
rather than subtracted.
2015-04-14 18:05:58 +10:00
Ilya Konstantinov
1b27538648 avfvideosrc: fix GL texture negotiation
GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE should no longer be used.
Instead, just get the GL context.

https://bugzilla.gnome.org/show_bug.cgi?id=747352
2015-04-14 18:05:57 +10:00
Ilya Konstantinov
4fd0f7277a avfvideosrc: fix setting of buffer offset end
Don't set offset end to random values off the stack.

https://bugzilla.gnome.org/show_bug.cgi?id=747352
2015-04-07 12:57:44 +01:00
ijsf
f62dda74cc Restricted activeVideoMaxFrameDuration to fix frame rate 2015-03-13 14:43:14 +00:00
Sebastian Dröge
160df421ea vtdec: Register a hardware-only vtdec_hw on OSX and give it a higher rank
while having the default vtdec at secondary rank. This allows decodebin/playbin
to prefer the hardware based decoders, and if that fails to initialize because
hardware resources are busy to fall back to e.g. the libav based h264 decoder
instead of the software based vtdec (which is slower), and only fall back to
the software based vtdec if there is no higher ranked decoder available.
2015-03-07 10:31:26 +01:00
Florian Zwoch
a8ae57480c avfvideosrc: allow "capture-screen" mode to select which screen to capture via the "device-index" option
https://bugzilla.gnome.org/show_bug.cgi?id=745161
2015-03-06 10:37:37 +01:00
Matthew Waters
0593480381 applemedia/avsamplesink: utilise a pull based approach of displaying video frames
Using requestMediaDataWhenReadyOnQueue the layer will execute a block
when it would like more frames. Using this we can provide the current
frame and avoid needlessly filling the layer's buffer queue causing
older frames to be displayed when under resource pressure.
2015-03-04 14:48:03 +11:00
Matthew Waters
c873c57430 vtdec: only attempt use of the texture cache with GLMemory caps features
Otherwise we send rectangle textures to glimagesink
2015-02-25 00:03:34 +11:00
Matthew Waters
e505f6257c applemedia: new AVSampleBufferLayerSink
Renders buffers using the CALayer subclass AVSampleBufferDisplayLayer
which can be placed inside a Core Animation render tree.
2015-02-24 19:12:10 +11:00
Sebastian Dröge
84ab11afdb avfvideosrc: Only set latency if we already know our caps
Otherwise we might set bogus values or GST_CLOCK_TIME_NONE.

Also make sure to reset the caps field to NULL after unreffing
the caps to prevent accidential use afterwards, and unref any
old caps before we remember new caps.
2015-02-19 01:03:35 +02:00
Sebastian Dröge
0c9f35653f vtenc: Check if VTSessionCopyProperty() succeeds before using the result
https://bugzilla.gnome.org/show_bug.cgi?id=744585
2015-02-16 12:35:09 +02:00
Alessandro Decina
6e325be516 applemedia: avfvideosrc: fix crash when non-GL memory is used 2015-02-13 19:12:54 +11:00
Sebastian Dröge
31f59cb344 avfvideosrc: Only use the duration of the sample if it is valid 2015-02-12 11:12:09 +02:00
Alessandro Decina
052e4804eb vtdec: fix texture sharing on iOS
Move GLES calls to the context thread. Fix
CVOpenGLESTextureCacheCreateTextureFromImage usage on iOS.
2015-02-09 21:18:24 +11:00
Sebastian Dröge
d4d02c6f9d corevideotexturecache: Add some assertions instead of just dereferencing NULL 2015-02-03 17:32:24 +01:00
Sebastian Dröge
b51254395a corevideotexturecache: Don't unconditionally use the CoreMedia meta on iOS
We might instead have a CoreVideo meta.
2015-02-03 17:32:24 +01:00
Sebastian Dröge
dac3e4ca06 vtdec: Don't dereference NULL frames when draining/flushing 2015-02-03 15:38:40 +01:00
Alessandro Decina
f577b52e5d applemedia: rework GL texture sharing
Use YUV instead of RGB textures, then convert using the new apple specific
shader in GstGLColorConvert. Also use GLMemory directly instead of using the
GL upload meta, avoiding an extra texture copy we used to have before.
2015-01-30 00:34:08 +11:00
Alessandro Decina
77d48abfab applemedia: vtdec: fix CMBlockBufferRef leak
Fix huge leak that went unnoticed for too long. Oops.
2015-01-30 00:34:08 +11:00
Alessandro Decina
8734abb1ce applemedia: don't call CVPixelBufferLockBaseAddress when doing texture sharing
When doing texture sharing we don't need to call CVPixelBufferLockBaseAddress to
map the buffer in CPU. This cuts about 10% relative cpu time from a vtdec !
glimagesink pipeline.
2015-01-30 00:34:08 +11:00
Alessandro Decina
e91989136a applemedia: corevideobuffer: make mapping the CVPixelBuffer in CPU optional
Mapping is not necessary and impacts performance when doing texture sharing with
downstream
2015-01-30 00:34:08 +11:00
Matthew Waters
c6056b0dd5 applemedia: update for gstgl cocoa -> cgl change 2015-01-23 16:12:24 +11:00
Alessandro Decina
d95a12e185 vtdec: implement the GL texture upload meta 2015-01-15 14:10:43 +11:00
Alessandro Decina
cdfe90aaba avfvideosrc: implement the GL texture upload meta 2015-01-15 14:10:43 +11:00
Florian Zwoch
7d318a572c vtenc: Unlock the stream lock while waiting for pending frames to be completed in finish()
We might otherwise deadlock because gst_vtenc_enqueue_buffer() can be
called again and will take the stream lock again from another thread.

https://bugzilla.gnome.org/show_bug.cgi?id=742174
2015-01-08 14:48:20 +01:00
Alessandro Decina
5496fd3e75 avfvideosrc: improve timestamp code
Use a combination of the running time and CMClockGetTime from AVF to compute
timestamps.
2014-12-27 12:43:45 +11:00
Sebastian Dröge
568da160cb vtenc: Instead of crashing if no corresponding frame is found, ignore this
... and hope that everything will be fine. This shouldn't really happen but
previously happened during shutdown. It should be fixed in videoencoder now,
but better be on the safe side here.
2014-12-22 11:49:08 +01:00
Alessandro Decina
0156725480 avfvideosrc: improve timestamping and latency reporting
Use AVF provided timings to timestamp output buffers. Use the running time at
the time the first buffer is produced to base timestamps on. Report 1-frame
latency based on the negotiated framerate instead of hardcoding 4ms latency.
2014-12-17 12:24:05 +11:00