首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >udpsink0无法在Android 10模拟器上创建套接字

udpsink0无法在Android 10模拟器上创建套接字
EN

Stack Overflow用户
提问于 2022-06-24 19:29:56
回答 1查看 38关注 0票数 1

我是安卓应用程序和GStreamer的新手,所以请容忍我。感谢您对解决此问题的任何指导。

在花费了大量的时间之后,我能够在1上成功地运行/移植所有GStreamer教程上的Pixel_3a_API_29仿真器和GStreamer预建库

现在,我正在尝试修改Android-turess-2和下面的管道,以便通过网络流发送音频数据,但是udpsink造成了问题。我已经证实了这一点,用udpsink替换了fakesink,并且管道运行良好。

代码语言:javascript
复制
const gchar *pipeline = "audiotestsrc ! audioconvert ! rtpL16pay ! udpsink";

错误仿真器映像

我做了一些故障排除,以找出问题所在,并能够找到错误gst_multiudpsink_start:<udpsink0> error: Could not create socket: Unable to create socket: Operation not permitted

我找到了线程,但它与我的环境完全无关。

代码语言:javascript
复制
2022-06-24 13:57:28.714 13587-13587/org.freedesktop.gstreamer.tutorials.tutorial_2 I/GStreamer: GStreamer initialization complete
2022-06-24 13:57:28.767 13587-13587/org.freedesktop.gstreamer.tutorials.tutorial_2 I/GStreamer: Activity created. There is no saved state, playing: false
2022-06-24 13:57:28.768 13587-13587/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.176483700 0x77698cb49d30 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:236:gst_native_init Created CustomData at 0x77698a063550
2022-06-24 13:57:28.768 13587-13587/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.176564000 0x77698cb49d30 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:238:gst_native_init Created GlobalRef for app object at 0x2cba
2022-06-24 13:57:28.768 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.177255400 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:163:app_function Creating pipeline in CustomData at 0x77698a063550
2022-06-24 13:57:28.770 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.179423700 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:206:app_function Entering main loop... (CustomData:0x77698a063550)
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.179482100 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:51:attach_current_thread Attaching thread 0x776989f9e210
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.179939100 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:143:check_initialization_complete Initialization complete, notifying application. main_loop:0x77698a07f8e0
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 I/GStreamer: Gst initialized. Restoring state, playing:false
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.180105000 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:279:gst_native_pause Setting state to PAUSED
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 W/GStreamer+multiudpsink: 0:00:00.180351400 0x776989f9e210 ../gst/udp/gstmultiudpsink.c:1445:gst_multiudpsink_start:<udpsink0> error: Could not create socket: Unable to create socket: Operation not permitted
2022-06-24 13:57:28.771 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 W/GStreamer+basesink: 0:00:00.180394100 0x776989f9e210 ../libs/gst/base/gstbasesink.c:5879:gst_base_sink_change_state:<udpsink0> error: Failed to start
2022-06-24 13:57:28.772 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.180738700 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:91:set_ui_message Setting message to: Error received from element udpsink0: GStreamer encountered a general resource error.
2022-06-24 13:57:28.772 13587-13663/org.freedesktop.gstreamer.tutorials.tutorial_2 D/GStreamer+tutorial-2: 0:00:00.181023400 0x776989f9e210 C:/Sandbox/gst-docs-master/examples/tutorials/android/android-tutorial-2/jni/tutorial-2.c:91:set_ui_message Setting message to: Error received from element udpsink0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
2022-06-24 13:57:28.822 13587-13660/org.freedesktop.gstreamer.tutorials.tutorial_2 D/HostConnection: HostConnection::get() New Host Connection established 0x7769d889f7c0, tid 13660
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-30 13:50:40

这不是代码的问题,而是权限的问题。显然,我不知道安卓应用程序是如何工作的,在AndroidManifest.xml中添加了以下内容解决了我的问题。

代码语言:javascript
复制
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

稍后,我还发现,如果您正在处理来自媒体的读写操作,其他的权限标记可能会很有用,

代码语言:javascript
复制
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

希望这能帮助像我这样的初学者。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72748617

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档