diff --git a/ml_inference_offloading/src/main/AndroidManifest.xml b/ml_inference_offloading/src/main/AndroidManifest.xml index e334201..ae552df 100644 --- a/ml_inference_offloading/src/main/AndroidManifest.xml +++ b/ml_inference_offloading/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ + + val inetAddress = linkAddress.address + if (inetAddress is Inet4Address && !inetAddress.isLoopbackAddress && inetAddress.isSiteLocalAddress) { + return inetAddress.hostAddress + } + } + + return "localhost" + } + private fun findPort(): Int { var port = -1 val portFinder = thread() { @@ -225,11 +241,12 @@ class MainService : Service() { } fun startServer() { + val hostAddress = getIpAddress() if (!isPortAvailable(port)) { port = findPort() } - val desc = "tensor_query_serversrc host=" + HOST_ADDR + " port=" + port.toString() + " ! " + + val desc = "tensor_query_serversrc host=" + hostAddress + " port=" + port.toString() + " ! " + "other/tensor,format=static,dimension=(string)3:224:224:1,type=uint8,framerate=0/1 ! " + "tensor_filter framework=tensorflow-lite model=" + model.getAbsolutePath() + " ! " + "other/tensor,format=static,dimension=(string)1001:1,type=uint8,framerate=0/1 ! tensor_query_serversink async=false"