applemedia: avfvideosrc: change texture format from BGRA to NV12 on iOS

Change texture format from BGRA to NV12. This allows a pipeline like avfvideosrc
! tee name=t ! ... ! glimagesink t. ! ... ! gldownload ! vtenc_h264 ! ...  to
negotiate GLMemory. This makes the glimagesink branch much faster (obviously)
and triggers the 0-copy path between avfvideosrc and vtenc (using the CV meta).
Combined this results in a huge perf improvement on iOS (25-30% of CPU time in a
pipeline like the one above).

Note that this doesn't introduce a new shader conversion in the sink, since BGRA
textures had to be copied/converted from format=BGRA,texture-target=RECTANGLE to
format=RGBA,texture-target=2D anyway.
This commit is contained in:
Alessandro Decina 2016-01-06 11:29:15 +11:00
parent 479dcdc3b4
commit a15d8acff0

View file

@ -55,7 +55,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
#else #else
GST_VIDEO_CAPS_MAKE_WITH_FEATURES GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
"BGRA") ", " "NV12") ", "
"texture-target = " GST_GL_TEXTURE_TARGET_2D_STR "; " "texture-target = " GST_GL_TEXTURE_TARGET_2D_STR "; "
#endif #endif
"video/x-raw, " "video/x-raw, "
@ -421,7 +421,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
#if !HAVE_IOS #if !HAVE_IOS
GstVideoFormat gl_format = GST_VIDEO_FORMAT_UYVY; GstVideoFormat gl_format = GST_VIDEO_FORMAT_UYVY;
#else #else
GstVideoFormat gl_format = GST_VIDEO_FORMAT_BGRA; GstVideoFormat gl_format = GST_VIDEO_FORMAT_NV12;
#endif #endif
GST_DEBUG_OBJECT (element, "Getting device caps"); GST_DEBUG_OBJECT (element, "Getting device caps");