<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Sebastian,<div><span class="Apple-tab-span" style="white-space:pre">   </span>I’ve modified osxaudio plugin to use Voice-Processing I/O unit instead of Remote I/O unit. I think you should add it to GStreamer project to support also VoIP or voice-chat application.</div><div>To use Voice-rocessing I/O unit I did these changes:</div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><section><div style="margin-top: 0px; margin-bottom: 0.833em;"><div style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px;">in <span style="color: rgb(209, 47, 27); font-family: Menlo; font-size: 11px;">gstosxcoreaudioremoteio.c</span><span style="font-family: Menlo; font-size: 11px;"> </span></div><div style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px;"><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(112, 61, 170);"><span style="color: rgb(187, 44, 162);">static</span> gboolean</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">gst_core_audio_open_impl (<span style="color: rgb(79, 129, 135);">GstCoreAudio</span> * core_audio)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(61, 29, 129);">  <span style="color: rgb(187, 44, 162);">return</span> <span style="color: rgb(49, 89, 93);">gst_core_audio_open_device</span> (core_audio, kAudioUnitSubType_VoiceProcessingIO,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                                       <span style="color: rgb(209, 47, 27);">"VoiceProcessingIO"</span>);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);">  //return gst_core_audio_open_device (core_audio, kAudioUnitSubType_RemoteIO,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);">  //    "RemoteIO");</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">}</div></div></div></section></div></blockquote>This patch was not enough to solve the issue because I received <span style="color: rgb(61, 29, 129); font-family: Menlo; font-size: 11px;">status = -50 </span>after some calls of AudioUnitRender in getosxaudiosrc.c, it seems <span style="color: rgb(61, 29, 129); font-family: Menlo; font-size: 11px;">AudioUnitRender </span>modifies <span style="color: rgb(61, 29, 129); font-family: Menlo; font-size: 11px;"> </span><span style="font-family: Menlo; font-size: 11px;">buf-></span><span style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">core_audio</span><span style="font-family: Menlo; font-size: 11px;">-></span><span style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">recBufferList</span><span style="font-family: Menlo; font-size: 11px;">-></span><span style="font-family: Menlo; font-size: 11px; color: rgb(112, 61, 170);">mBuffers</span><span style="font-family: Menlo; font-size: 11px;">[</span><span style="font-family: Menlo; font-size: 11px; color: rgb(39, 42, 216);">0</span><span style="font-family: Menlo; font-size: 11px;">].</span><span style="font-family: Menlo; font-size: 11px; color: rgb(112, 61, 170);">mDataByteSize </span>based on data returned, so before call AudioUnitRender it requires to set <font color="#703daa" style="font-family: Menlo; font-size: 11px;">mDataByteSize</font><span style="font-size: 11px;"><font face="Menlo"> </font>today I’ve created mine osxaudio plugin with these changes, hardcoding<font face="Menlo"> "bytes per frame” </font>and <font face="Menlo">“channels”</font> and solved my problem, I did’d check the buffer allocated because it’s big enough.</span></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><div style="margin: 0px; color: rgb(79, 129, 135);"><span style="color: rgb(0, 0, 0);">buf-></span>core_audio<span style="color: rgb(0, 0, 0);">-></span>recBufferList<span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(112, 61, 170);">mNumberBuffers</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(39, 42, 216);">1</span><span style="color: rgb(0, 0, 0);">;</span></div><div style="margin: 0px;">buf-><span style="color: #4f8187">core_audio</span>-><span style="color: #4f8187">recBufferList</span>-><span style="color: #703daa">mBuffers</span>[<span style="color: #272ad8">0</span>].<span style="color: #703daa">mDataByteSize</span>=inNumberFrames*<span style="color: #272ad8">4/*where 4 is bytes per frame*/</span>;</div><div style="margin: 0px; color: rgb(79, 129, 135);"><span style="color: #000000">buf-></span>core_audio<span style="color: #000000">-></span>recBufferList<span style="color: #000000">-></span><span style="color: #703daa">mBuffers</span><span style="color: #000000">[</span><span style="color: #272ad8">0</span><span style="color: #000000">].</span><span style="color: #703daa">mNumberChannels</span><span style="color: #000000">=</span><span style="color: #272ad8">1 /*num of channels*/</span><span style="color: #000000">;</span></div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">status = <span style="color: #3d1d81">AudioUnitRender</span> (buf-><span style="color: #4f8187">core_audio</span>-><span style="color: #4f8187">audiounit</span>, ioActionFlags,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">      inTimeStamp, inBusNumber, inNumberFrames, buf-><span style="color: #4f8187">core_audio</span>-><span style="color: #4f8187">recBufferList</span>);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  <span style="color: #bb2ca2">if</span> (status) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);"><span style="color: #000000">    </span><span style="color: #78492a">GST_WARNING_OBJECT</span><span style="color: #000000"> (buf, </span>"AudioUnitRender returned %d"<span style="color: #000000">, (</span><span style="color: #bb2ca2">int</span><span style="color: #000000">) status);</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    <span style="color: #bb2ca2">return</span> status;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);"><br></div></div><div style="margin: 0px;">Have a nice day</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Elio</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div><div><div>On 05 Jul 2014, at 12:09, Elio Francesconi <<a href="mailto:elio.francesconi@gmail.com">elio.francesconi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Sebastian,<div>reading documentation I’ve found the issue, </div><div><section><div><br></div><div><a href="https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/AudioUnitHostingGuide_iOS/AudioUnitHostingFundamentals/AudioUnitHostingFundamentals.html">https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/AudioUnitHostingGuide_iOS/AudioUnitHostingFundamentals/AudioUnitHostingFundamentals.html</a></div><div><span style="font-size: 16px;">I/O Units</span></div><div style="margin-top: 0px; margin-bottom: 0.833em; font-size: 13px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;">iOS provides three I/O units. The <span style="font-weight: 700;">Remote I/O unit </span>is the most commonly used. It connects to input and output audio hardware and gives you low–latency access to individual incoming and outgoing audio sample values. It provides format conversion between the hardware audio formats and your application audio format, doing so by way of an included Format Converter unit. For sample code that shows how to use the Remote I/O unit, see the sample code project <em><a href="https://developer.apple.com/library/ios/samplecode/aurioTouch/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007770" target="_self" style="color: rgb(51, 102, 204); text-decoration: none;">aurioTouch</a></em>.</div><div style="margin-top: 0px; margin-bottom: 0.833em; font-size: 13px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;">The <span style="font-weight: 700;">Voice-Processing I/O unit</span> extends the Remote I/O unit by adding acoustic echo cancelation for use in a VoIP or voice-chat application. It also provides automatic gain correction, adjustment of voice-processing quality, and muting.</div><div style="margin-top: 0px; margin-bottom: 0.833em; font-size: 13px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;">The <span style="font-weight: 700;">Generic Output unit</span> does not connect to audio hardware but rather provides a mechanism for sending the output of a processing chain to your application. You would typically use the Generic Output unit for offline audio processing.</div><div style="margin-top: 0px; margin-bottom: 0.833em; font-size: 13px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;">The osxaudiosrc plugin is using <span style="font-weight: bold;">Remote I/O unit </span>but for it is not suited for VoIP purpose :-( </div><div style="margin-top: 0px; margin-bottom: 0.833em; font-size: 13px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;">In gstosxcoreaudio.c I see:</div><div style="margin-top: 0px; margin-bottom: 0.833em;"><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(120, 73, 42);">#ifdef HAVE_IOS</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(209, 47, 27);"><span style="color: #78492a">#include </span>"gstosxcoreaudioremoteio.c"</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(120, 73, 42);">#else</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(209, 47, 27);"><span style="color: #78492a">#include </span>"gstosxcoreaudiohal.c"</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; color: rgb(120, 73, 42);">#endif</div><div style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px;"><br></div><div style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px;">To try to solve the issue I’ve modified this section in <span style="color: rgb(209, 47, 27); font-family: Menlo; font-size: 11px;">gstosxcoreaudioremoteio.c</span><span style="font-family: Menlo; font-size: 11px;"> </span></div><div style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px;"><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(112, 61, 170);"><span style="color: #bb2ca2">static</span><span style=""> </span>gboolean</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">gst_core_audio_open_impl (<span style="color: #4f8187">GstCoreAudio</span> * core_audio)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="">  </span><span style="color: #bb2ca2">return</span><span style=""> </span><span style="color: #31595d">gst_core_audio_open_device</span><span style=""> (core_audio, </span>kAudioUnitSubType_VoiceProcessingIO<span style="">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                                       <span style="color: #d12f1b">"VoiceProcessingIO"</span>);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="">  </span>//return gst_core_audio_open_device (core_audio, kAudioUnitSubType_RemoteIO,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="">  </span>//    "RemoteIO");</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">}</div></div><div style="margin: 0px;"><font face="Lucida Grande, Lucida Sans Unicode, Helvetica, Arial, Verdana, sans-serif" size="2">Unfortunately it’s not enough because with this patch It is not enough, I’ll work on that and find why it is not working but.. in case you already have experience with  </font><span style="color: rgb(61, 29, 129); font-family: Menlo; font-size: 11px;">kAudioUnitSubType_VoiceProcessingIO</span> <span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: small;">I appreciate your help.</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px;"><br></div><div style="font-family: Menlo; font-size: 11px; margin: 0px;">Thanks</div><div style="font-family: Menlo; font-size: 11px; margin: 0px;">Elio</div></div></section><section><a name="//apple_ref/doc/uid/TP40009492-CH3-SW18" title="Format Converter Unit" style="color: rgb(51, 102, 204); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);"></a></section></div><div>On 05 Jul 2014, at 11:14, Sebastian Dröge <<a href="mailto:sebastian@centricular.com">sebastian@centricular.com</a>> wrote:</div><div><div><br class="Apple-interchange-newline"><blockquote type="cite">On Sa, 2014-07-05 at 10:43 +0200, Elio Francesconi wrote:<br><blockquote type="cite">Hi all,<br>thanks to your supposrt I’ve released a voip application based on GStreamer :-) <a href="https://itunes.apple.com/it/app/ipdoor/id881935787?mt=8">https://itunes.apple.com/it/app/ipdoor/id881935787?mt=8</a><br>Unfortunately our customer are complaining about acoustic echo on iPad devices.<br></blockquote><br>Thanks for letting us know, that's good news :) More GStreamer apps in<br>the app store, or at least more we know about ;)<br><br><blockquote type="cite">I’m using GStreamer version 1.2.4 and I’ve added a schema about my two pipelines, it seems osxaudiosink and osxaudiosrc generate a bad acoustic echo, <br><br>Someone has experience on such kind of issues?<br>[...]<br></blockquote><br>What kind of echo is this? Is the microphone capturing the speaker<br>output again, i.e. are sender and receiver close enough for that to<br>work? Do you also get an echo if you write to a file instead of directly<br>outputting it on the speakers?<br><br>If it's the normal echo you get when capturing what your speakers<br>output, and then output that captured audio again... then you need to<br>insert an echo cancellation filter somewhere in your application between<br>the capture and output. Which might be a bit tricky because capture and<br>output is on different devices in your case.<br><br>-- <br>Sebastian Dröge, Centricular Ltd - <a href="http://www.centricular.com/">http://www.centricular.com</a><br>Expertise, Straight from the Source<br>_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br><a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br></blockquote></div><br></div></div></blockquote></div><br></div></body></html>