【问题标题】:LibStreaming gives black screen when change resolution更改分辨率时,LibStreaming 会出现黑屏
【发布时间】:2018-03-21 13:35:36
【问题描述】:

我使用来自https://github.com/fyhertz/spydroid-ipcamera 的 spydroid。 根据要求,应在设备中发送和接收流。从本地网络我们应该能够显示 rtsp 流。前任。 VLC 媒体播放器。

我面临的问题是,当我更改分辨率时,例如。 640*480。它应该给黑屏直播。在默认演示中,它应该支持 320*240,工作正常。我还根据 640*480 分辨率更改了比特率和帧率。但无法得到结果。

任何帮助将不胜感激。

【问题讨论】:

    标签: android video-streaming streaming rtsp


    【解决方案1】:

    您可能正在使用演示 SpyDroid 正在使用的旧库。

    我尝试以下方式的代码有同样的问题:-

    步骤:-

    1.)包含库LibStreaming

    • 因为它是最新的库并且支持高于 Lollipop 版本。

    2.)找到H263Stream class 更改以下方法:-

    来自

    @SuppressLint("NewApi")
    private MP4Config testMediaCodecAPI() throws RuntimeException, IOException {
        createCamera();
        updateCamera();
        try {
            if (mQuality.resX>=640) {
                // Using the MediaCodec API with the buffer method for high resolutions is too slow
                mMode = MODE_MEDIARECORDER_API;
            }
            EncoderDebugger debugger = EncoderDebugger.debug(mSettings, mQuality.resX, mQuality.resY);
            return new MP4Config(debugger.getB64SPS(), debugger.getB64PPS());
        } catch (Exception e) {
            // Fallback on the old streaming method using the MediaRecorder API
            Log.e(TAG,"Resolution not supported with the MediaCodec API, we fallback on the old streamign method.");
            mMode = MODE_MEDIARECORDER_API;
            return testH264();
        }
    

    }

    收件人

    @SuppressLint("NewApi")
    private MP4Config testMediaCodecAPI() throws RuntimeException, IOException {
        createCamera();
        updateCamera();
        try {
            if (mQuality.resX>=1080) {
                // Using the MediaCodec API with the buffer method for high resolutions is too slow
                mMode = MODE_MEDIARECORDER_API;
            }
            EncoderDebugger debugger = EncoderDebugger.debug(mSettings, mQuality.resX, mQuality.resY);
            return new MP4Config(debugger.getB64SPS(), debugger.getB64PPS());
        } catch (Exception e) {
            // Fallback on the old streaming method using the MediaRecorder API
            Log.e(TAG,"Resolution not supported with the MediaCodec API, we fallback on the old streamign method.");
            mMode = MODE_MEDIARECORDER_API;
            return testH264();
        }
    }
    

    -您可以找到从“640”到“1080”的差异变化分辨率

    -不知道确切的原因是什么,但上述解决方案对我有用。

    -如果有任何循环掉落,请还原我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-04
      • 1970-01-01
      • 2014-05-25
      • 2014-01-15
      • 1970-01-01
      相关资源
      最近更新 更多