使用 Gstreamer 时在 Android 中出现 "Unacceptable TLS cerificate" 错误

Getting "Unacceptable TLS cerificate" error in Android when using Gstreamer

我目前使用 GStreamer 设置我的项目,我想流式传输 RTSP link。在将 GStreamer 与我的项目集成之前,我阅读了 [此处][1] 中提到的教程,并使用我自己的 rtsp link 测试了媒体 uri。有效!但它无法在我的项目上工作。有什么我应该寻找的吗?

-项目指向最新的gstreamer库

-项目也是指向最尖的ndk build

-C 代码运行良好,因为我能够看到提供的日志。

下面提供了完整的日志和错误:

2020-11-11 15:54:25.186 4248-4248/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.785514844 0x789bdded60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:369:check_initialization_complete Initialization complete, notifying application. native_window:0x791bd7b4a0 main_loop:0x77abda46f0
2020-11-11 15:54:25.187 4248-4248/com.name.app.debug E/GStreamer: GStreamer initialized:
2020-11-11 15:54:25.187 4248-4248/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.785556094 0x789bdded60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:515:gst_native_set_uri Setting URI to rtsp://censored
2020-11-11 15:54:25.187 4248-4248/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.785683907 0x789bdded60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:566:gst_native_set_position Scheduling seek to 0:00:00.000000000 for later
2020-11-11 15:54:25.187 4248-4248/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.785701719 0x789bdded60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:533:gst_native_play Setting state to PLAYING
2020-11-11 15:54:25.188 4248-4248/com.name.app.debug I/GStreamer:   playing:
2020-11-11 15:54:25.188 4248-4726/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.786643073 0x789be89f60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:115:set_ui_message Setting message to: State changed to PAUSED
2020-11-11 15:54:25.188 4248-4726/com.name.app.debug E/gStreamer: Setting up message...State changed to PAUSED
2020-11-11 15:54:25.188 4248-4726/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.786874219 0x789be89f60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:209:execute_seek Seeking to 0:00:00.000000000
2020-11-11 15:54:25.197 4248-4726/com.name.app.debug W/GStreamer+tutorial-5: 0:06:35.795876512 0x789be89f60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:155:refresh_ui Could not query current duration (normal for still pictures)
2020-11-11 15:54:25.197 4248-4726/com.name.app.debug W/GStreamer+tutorial-5: 0:06:35.795964585 0x789be89f60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:162:refresh_ui Could not query current position (normal for still pictures)
2020-11-11 15:54:25.227 4248-4747/com.name.app.debug E/GStreamer+default: 0:06:35.826470421 0x78bbdb14a0 ../gst-libs/gst/rtsp/gstrtspconnection.c:1052:gst_rtsp_connection_connect_with_response_usec failed to connect: Unacceptable TLS certificate
2020-11-11 15:54:25.227 4248-4747/com.name.app.debug E/GStreamer+rtspsrc: 0:06:35.826515473 0x78bbdb14a0 ../gst/rtsp/gstrtspsrc.c:5137:gst_rtsp_conninfo_connect:<source> Could not connect to server. (Generic error)
2020-11-11 15:54:25.228 4248-4747/com.name.app.debug W/GStreamer+rtspsrc: 0:06:35.826535682 0x78bbdb14a0 ../gst/rtsp/gstrtspsrc.c:7999:gst_rtspsrc_retrieve_sdp:<source> error: Failed to connect. (Generic error)
2020-11-11 15:54:25.228 4248-4747/com.name.app.debug W/GStreamer+rtspsrc: 0:06:35.826635786 0x78bbdb14a0 ../gst/rtsp/gstrtspsrc.c:8084:gst_rtspsrc_open:<source> can't get sdp
2020-11-11 15:54:25.228 4248-4747/com.name.app.debug W/GStreamer+rtspsrc: 0:06:35.826670109 0x78bbdb14a0 ../gst/rtsp/gstrtspsrc.c:8745:gst_rtspsrc_play:<source> failed to open stream
2020-11-11 15:54:25.228 4248-4747/com.name.app.debug W/GStreamer+rtspsrc: 0:06:35.826690317 0x78bbdb14a0 ../gst/rtsp/gstrtspsrc.c:6116:gst_rtspsrc_loop:<source> we are not connected
2020-11-11 15:54:25.228 4248-4726/com.name.app.debug D/GStreamer+tutorial-5: 0:06:35.826741932 0x789be89f60 C:/Users/path/project-name/app/src/main/jni/tutorial-5.c:115:set_ui_message Setting message to: Error received from element source: Could not open resource for reading and writing.


  [1]: https://gstreamer.freedesktop.org/documentation/tutorials/android/index.html?gi-language=c

找到答案了!显然我的 ssl 证书文件夹位于错误的资产目录文件夹 src/assets/ssl/certs/ca-certificates.crt 中,它应该位于 src/main/assets 文件夹中。愚蠢的错误,但我希望这可以帮助其他人!