From a15d8acff024a0ecd1dfca20cfecb2ad4dc2a546 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 6 Jan 2016 11:29:15 +1100 Subject: [PATCH] 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. --- sys/applemedia/avfvideosrc.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m index 455fd2f..6d3390d 100644 --- a/sys/applemedia/avfvideosrc.m +++ b/sys/applemedia/avfvideosrc.m @@ -55,7 +55,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", #else GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, - "BGRA") ", " + "NV12") ", " "texture-target = " GST_GL_TEXTURE_TARGET_2D_STR "; " #endif "video/x-raw, " @@ -421,7 +421,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer #if !HAVE_IOS GstVideoFormat gl_format = GST_VIDEO_FORMAT_UYVY; #else - GstVideoFormat gl_format = GST_VIDEO_FORMAT_BGRA; + GstVideoFormat gl_format = GST_VIDEO_FORMAT_NV12; #endif GST_DEBUG_OBJECT (element, "Getting device caps"); -- 2.7.4