<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="" class=""><span style="" class="">I do not have an answer on the tactical level with regards to the specific coding issue but, on the strategic level you might want to read the following post discussing echo cancellation on Android <a style="" class="" href="http://www.solicall.com/blog/why-echo-cancellation-for-android-is-a-difficult-task/">http://www.solicall.com/blog/why-echo-cancellation-for-android-is-a-difficult-task/</a>. <br style=""></span></div><div> </div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida
Grande, sans-serif; font-size: 12pt;"> <div style="" class="" dir="ltr"> <font style="" class="" face="Arial" size="2"> On Tuesday, July 1, 2014 10:36 PM, Puyol <paul9510@hotmail.fr> wrote:<br style="" class=""> </font> </div> <br style="" class=""><br style="" class=""> <div style="" class="">Hello!!<br style="" class="">My problem is how to cancel echo using jni in android between two devices. <br style="" class="">I tried to use this code but it didn't work to me! <br style="" class=""><br style="" class="">#include <jni.h><br style="" class="">#include "speex/speex_echo.h"<br style="" class="">#include "speex/speex_preprocess.h"<br style="" class="">#include "EchoCanceller_jniHeader.h"<br style="" class="">SpeexEchoState *st;<br style="" class="">SpeexPreprocessState *den;<br style="" class=""><br style="" class="">JNIEXPORT void JNICALL Java_speex_EchoCanceller_open<br style="" class=""> (JNIEnv *env, jobject jObj, jint
jSampleRate, jint jBufSize, jint<br style="" class="">jTotalSize)<br style="" class="">{<br style="" class=""> //init<br style="" class=""> int sampleRate=jSampleRate;<br style="" class=""> st = speex_echo_state_init(jBufSize, jTotalSize);<br style="" class=""> den = speex_preprocess_state_init(jBufSize, sampleRate);<br style="" class=""> speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate);<br style="" class=""> speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st);<br style="" class="">}<br style="" class=""><br style="" class="">JNIEXPORT jshortArray JNICALL Java_speex_EchoCanceller_process<br style="" class=""> (JNIEnv * env, jobject jObj, jshortArray input_frame, jshortArray<br style="" class="">echo_frame)<br style="" class="">{<br style="" class=""> //create native shorts from java shorts<br style="" class=""> jshort
*native_input_frame = (*env)->GetShortArrayElements(env,<br style="" class="">input_frame, NULL);<br style="" class=""> jshort *native_echo_frame = (*env)->GetShortArrayElements(env, echo_frame,<br style="" class="">NULL);<br style="" class=""><br style="" class=""> //allocate memory for output data<br style="" class=""> jint length = (*env)->GetArrayLength(env, input_frame);<br style="" class=""> jshortArray temp = (*env)->NewShortArray(env, length);<br style="" class=""> jshort *native_output_frame = (*env)->GetShortArrayElements(env, temp, 0);<br style="" class=""><br style="" class=""> //call echo cancellation<br style="" class=""> speex_echo_cancellation(st, native_input_frame, native_echo_frame,<br style="" class="">native_output_frame);<br style="" class=""> //preprocess output frame<br style="" class=""> speex_preprocess_run(den, native_output_frame);<br style="" class=""><br
style="" class=""> //convert native output to java layer output<br style="" class=""> jshortArray output_shorts = (*env)->NewShortArray(env, length);<br style="" class=""> (*env)->SetShortArrayRegion(env, output_shorts, 0, length,<br style="" class="">native_output_frame);<br style="" class=""><br style="" class=""> //cleanup and return<br style="" class=""> (*env)->ReleaseShortArrayElements(env, input_frame, native_input_frame,<br style="" class="">0);<br style="" class=""> (*env)->ReleaseShortArrayElements(env, echo_frame, native_echo_frame, 0);<br style="" class=""> (*env)->ReleaseShortArrayElements(env, temp, native_output_frame, 0);<br style="" class=""><br style="" class=""> return output_shorts; <br style="" class="">}<br style="" class=""><br style="" class="">JNIEXPORT void JNICALL Java_speex_EchoCanceller_close<br style="" class=""> (JNIEnv *env, jobject jObj)<br
style="" class="">{<br style="" class=""> //close<br style="" class=""> speex_echo_state_destroy(st);<br style="" class=""> speex_preprocess_state_destroy(den);<br style="" class="">}<br style="" class=""><br style="" class="">the first problem is that there is no file with name<br style="" class="">"EchoCanceller_jniHeader.h"<br style="" class="">the second : in SpeexEchoState *st; SpeexPreprocessState *den; I get this<br style="" class="">error: Type 'SpeexEchoState' could not be resolved<br style="" class="">How can I resolve this?<br style="" class=""><br style="" class=""><br style="" class=""><br style="" class="">--<br style="" class="">View this message in context: <a style="" class="" href="http://gstreamer-devel.966125.n4.nabble.com/Echo-cancellation-gstreamer-android-NDK-tp4667761.html"
target="_blank">http://gstreamer-devel.966125.n4.nabble.com/Echo-cancellation-gstreamer-android-NDK-tp4667761.html</a><br style="" class="">Sent from the GStreamer-devel mailing list archive at Nabble.com.<br style="" class="">_______________________________________________<br style="" class="">gstreamer-devel mailing list<br style="" class=""><a style="" class="" ymailto="mailto:gstreamer-devel@lists.freedesktop.org" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br style="" class=""><a style="" class="" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br style="" class=""><br style="" class=""><br style="" class=""></div> </div> </div> </div> </div></body></html>