ios - Mute Audio AVCaptureSession -


i trying mute , unmute audio avcapturesession. once start sessions can enable , disable audio connection, once play video of audio portions pushed back @ front of video leaving end of video no sound. seems time stamp issue don't know how be. in case have tried adjust pts of audio sample buffer match previous video buffer.

for pausing

if (self.muted) {     [self.session beginconfiguration];     self.audioconnection.enabled = no;     [self.session commitconfiguration]; } else {     [self.session beginconfiguration];     self.audioconnection.enabled = yes;     [self.session commitconfiguration]; } 

for adjusting time stamp grab last timestamp

if ( connection == self.videoconnection ) {      // timestamp     cmtime timestamp = cmsamplebuffergetpresentationtimestamp( samplebuffer );     testprevioustimestamp = timestamp; 

then adjust timestamp on sample buffer

cmsamplebuffersetoutputpresentationtimestamp (samplebuffer,testprevioustimestamp);  if (![self.assetwriteraudioin appendsamplebuffer:samplebuffer]) {         [self showerror:[self.assetwriter error]];                     nslog(@"problem writing audio sample buffer"); } 

any ideas problem , how fix it?

rather adjusting time stamp had no luck with. wrote 0 data buffer. works , way don't need disable/enable connections.

        // write audio data file         if (readytorecordaudio && readytorecordvideo) {             if (self.muted) {                 cmblockbufferref buffref = cmsamplebuffergetdatabuffer(samplebuffer);                 char fillbyte = 0;                 cmblockbufferfilldatabytes(fillbyte,buffref,0,cmblockbuffergetdatalength(buffref));             }             [self writesamplebuffer:samplebuffer oftype:avmediatypeaudio];         } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -