ios - AVSampleBufferDisplayLayer with VTDecompressionSession -


i've been struggling avsamplebufferdisplaylayer being choppy lot of motion. when there motion in live stream, come pixelated , half frozen multiple frames displaying @ once. however, once added following piece of code, solved:

vtdecodeframeflags flags = kvtdecodeframe_enableasynchronousdecompression  | kvtdecodeframe_enabletemporalprocessing; vtdecodeinfoflags flagout; vtdecompressionsessiondecodeframe(decompressionsession, samplebuffer, flags, (void*)cfbridgingretain(null), &flagout); 

note did create decompression session before, don't in callback. still calling enqueuesamplebuffer: on avsamplebufferdisplaylayer , how video displayed on screen.

do have call vtdecompressionsessiondecodeframe avsamplebufferdisplaylayer display correctly? thought avsamplebufferdisplaylayerr use vtdecompressionsessiondecodeframe internally. due being on ios simulator?

avsamplebufferdisplaylayer , vtdecompressionsession 2 different things, although avsamplebufferdisplaylayer may use vtdecompressionsession under hood (i don't know). don't use them together, 1 or other vtdecompressionsession lower level avsamplebufferdisplaylayer. not , should not call vtdecompressionsessiondecodeframe() work avsampledisplaylayer enqueuesamplebuffer().

from description, sounds have timing issue pts (presentation time stamps). make sure set time base correctly.

see here: set rate @ avsamplebufferdisplaylayer renders sample buffers

also, make sure feeding avsamplebufferdisplaylayer frames in encoder order (the order came out of encoder in), not display order.

finally, make sure aren't dropping packets somewhere on network, if using udp.


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -