DJI SDK 5.1.7 主频道上的 RTMP 流使 Android 主应用程序崩溃

问题描述 投票:0回答:1

在流式传输到我的云 RTMP 服务器几分钟后,我的主应用程序崩溃了。应用程序崩溃附在本文底部。

一点背景 - 该代码适用于在三星 Galaxy S22 上运行的 dji mini 3,使用源自 sdk 5.1.7 的示例应用程序

https://github.com/dji-sdk/Mobile-SDK-Android-V5/blob/dev-sdk-main/SampleCode-V5/android-sdk-v5-uxsdk/src/main/java/dji/ v5/ux/sample/showcase/defaultlayout/DefaultLayoutActivity.java

这是主应用程序上的代码,该代码在片段(主片段)上运行并在CreateView 上执行

 // note this is a listener and when the stream source is updated it gets called
            MediaDataCenter.getInstance().getVideoStreamManager().addStreamSourcesListener
                    (sources -> getActivity().runOnUiThread(() -> updateFPVWidgetSource(sources)));
            primaryFpvWidget.setOnFPVStreamSourceListener((devicePosition, lensType) -> {
                cameraSourceProcessor.onNext(new HomeFragment.CameraSource(devicePosition, lensType));
            });

IVideoChannel primaryChannel =
                MediaDataCenter.getInstance().getVideoStreamManager().getAvailableVideoChannel(VideoChannelType.PRIMARY_STREAM_CHANNEL); if (primaryChannel != null) {
            primaryChannelStateListener = (from, to) -> {
                StreamSource primaryStreamSource = primaryChannel.getStreamSource();
                if (VideoChannelState.ON == to && primaryStreamSource != null) {
                   
                    getActivity().runOnUiThread(() -> primaryFpvWidget.updateVideoSource(primaryStreamSource, VideoChannelType.PRIMARY_STREAM_CHANNEL));

                }
            };
            primaryChannel.addVideoChannelStateChangeListener(primaryChannelStateListener);

产品连接后, 在产品连接后的单独工作线程中,我像这样启动流:

ILiveStreamManager liveStreamManager = MediaDataCenter.getInstance().getLiveStreamManager();

            LiveStreamSettings.Builder lssBuilder = new LiveStreamSettings.Builder();

            RtmpSettings.Builder b = new RtmpSettings.Builder();
            b.setUrl(liveURL);
            RtmpSettings rtmp = b.build();
            lssBuilder.setRtmpSettings(rtmp);
            lssBuilder.setLiveStreamType(LiveStreamType.RTMP);
            LiveStreamSettings lss = lssBuilder.build();

            liveStreamManager.setLiveStreamSettings(lss);

            // the video going to app display is primary - MUST BE PRIMARY!!! or dont see video
            
            liveStreamManager.setVideoChannelType(VideoChannelType.PRIMARY_STREAM_CHANNEL);
            liveStreamManager.setLiveStreamQuality(StreamQuality.SD); // make quality lower? 
            //liveStreamManager.setLiveVideoBitrate(2048); // small
            liveStreamManager.setLiveVideoBitrateMode(LiveVideoBitrateMode.AUTO);

              liveStreamManager.startStream(new CommonCallbacks.CompletionCallback() {...}

我做错了什么?

崩溃输出

2023-11-03 14:42:44.584 14829-14829/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:44.584 14829-14829/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:44.589 12914-12988/com.tbolt.main E/fdsan: failed to exchange ownership of file descriptor: fd 297 is owned by unique_fd 0x6e6ca9d75c, was expected to be unowned
2023-11-03 14:42:44.620 12914-14680/com.tbolt.main E/co_b: (co_a:86) checkFrame() lastId = 18150 id=18156
2023-11-03 14:42:44.776 12914-12988/com.tbolt.main E/fdsan: attempted to close file descriptor 297, expected to be owned by unique_fd 0x6e6ca9dd9c, actually owned by unique_fd 0x6e6ca9d75c
2023-11-03 14:42:44.963 14834-14834/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:44.963 14834-14834/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:44.974 12914-14824/com.tbolt.main E/fdsan: failed to exchange ownership of file descriptor: fd 297 is owned by unique_fd 0x6e6ca9d75c, was expected to be unowned
2023-11-03 14:42:45.081 12914-14687/com.tbolt.main W/DJIV5/co_c@1a50a50: (co_b:99) onOutputFrame() frame index:18161
2023-11-03 14:42:45.161 12914-14688/com.tbolt.main E/co_b: (co_a:104) checkFrame()  len=6840 checkLen=11802 seiOffset:6854
2023-11-03 14:42:45.167 12914-12985/com.tbolt.main A/libc: Fatal signal 11 (SIGSEGV), code -6 (SI_TKILL) in tid 12985 (com.tbolt.main), pid 12914 (com.tbolt.main)
2023-11-03 14:42:45.201 12914-14685/com.tbolt.main E/co_b: (co_a:86) checkFrame() lastId = 18163 id=18166
2023-11-03 14:42:45.204 12914-12988/com.tbolt.main E/fdsan: attempted to close file descriptor 297, expected to be owned by unique_fd 0x6e6ca9abdc, actually owned by unique_fd 0x6e6ca9d75c
2023-11-03 14:42:45.332 14840-14840/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:45.332 14840-14840/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:45.682 14846-14846/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:45.682 14846-14846/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:45.710 12914-14680/com.tbolt.main E/co_b: (co_a:86) checkFrame() lastId = 18175 id=18178
2023-11-03 14:42:46.049 14852-14852/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:46.049 14852-14852/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:46.368 12914-14687/com.tbolt.main W/DJIV5/co_c@1a50a50: (co_b:99) onOutputFrame() frame index:18194
2023-11-03 14:42:46.429 14859-14859/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:46.429 14859-14859/? A/DEBUG: pid: 12914, tid: 12914, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:46.812 14864-14864/? A/DEBUG: Cmdline: com.tbolt.main
2023-11-03 14:42:46.812 14864-14864/? A/DEBUG: pid: 12914, tid: 12985, name: com.tbolt.main  >>> com.tbolt.main <<<
2023-11-03 14:42:46.856 2299-14876/? W/ActivityManager: crash : com.tbolt.main,10274
2023-11-03 14:42:46.856 2299-14876/? W/ActivityTaskManager:   Force finishing activity com.tbolt.main/.MainActivity
2023-11-03 14:42:46.985 2299-5904/? W/InputManager-JNI: Input channel object 'bebdddd com.tbolt.main/com.tbolt.main.MainActivity (client)' was disposed without first being removed with the input manager!



android rtmp dji-sdk
1个回答
0
投票

我也遇到了 msdk v5 示例和 RTMP 的问题。 我在测试工具部分看到 rtmp 运行良好, 也许有办法调用那里的方法?

© www.soinside.com 2019 - 2024. All rights reserved.