Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Preview and push stream are all black

I use ZEGOCLOUD express SDK. After accessing beauty through custom pre-processing, the preview and push stream are all black.

code:

express.enableCustomVideoProcessing( enable: true, config, ZegoPublishChannel.MAIN);
express.setCustomVideoProcessHandler(new IZegoCustomVideoProcessHandler(){
    @Override
    public void onStart (ZegoPublishChannel channel) {
        Log_i(tag:"ZEGOCLOUD", msg:"[Express] [onStart]");
        effects.initEnv(720, 1280);
    }

    @override
    public void onStop(ZegoPublishChannel channel) {
        Log_i(tag:"ZEGOCLOUD", msg:"[Express] [onStop]");
        effects.uninitEnv();
    }

    @Override
    public void onCapturedUnprocessedTextureData(int textureID, int width, int height, Long referenceTimeMillisecond, ZegoPublishChannel channel) {
        Log.i( tag: "ZEGOCLOUD". msg: "[Exoress] [onCapturedUnprocessedTextureData] textureID:" + textureID + "width:" + width + "height: " + height + ", ts:" + referenceTimeMillisecond);

        effectsVideoFrameParam.width = width;
        effectsVideoFrameParam.height = height;


        int processedTextureID = effects.processTexture(textureID, effectsVideoFrameParam);

        express.sendCustomVideoProcessedTextureData(processedTextureID, width, height, referenceTimeMillisecond);
    }
});

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The effects initialization is called in onStart, but there is a problem with the glcontext obtained here, and then beautify in onCapturedUnprocessedTextureData, because the glcontext is wrong, it reads black.

So you need to move effects.initEnv() to the onCapturedUnprocessedTextureData method.

like it:

express.enableCustomVideoProcessing( enable: true, config, ZegoPublishChannel.MAIN);
express.setCustomVideoProcessHandler(new IZegoCustomVideoProcessHandler(){
    @Override
    public void onStart (ZegoPublishChannel channel) {
        Log_i(tag:"ZEGOCLOUD", msg:"[Express] [onStart]");
    }

    @override
    public void onStop(ZegoPublishChannel channel) {
        Log_i(tag:"ZEGOCLOUD", msg:"[Express] [onStop]");
        effects.uninitEnv();
    }

    @Override
    public void onCapturedUnprocessedTextureData(int textureID, int width, int height, Long referenceTimeMillisecond, ZegoPublishChannel channel) {
        Log.i( tag: "ZEGOCLOUD". msg: "[Exoress] [onCapturedUnprocessedTextureData] textureID:" + textureID + "width:" + width + "height: " + height + ", ts:" + referenceTimeMillisecond);
        
        effects.initEnv(720, 1280);

        effectsVideoFrameParam.width = width;
        effectsVideoFrameParam.height = height;


        int processedTextureID = effects.processTexture(textureID, effectsVideoFrameParam);

        express.sendCustomVideoProcessedTextureData(processedTextureID, width, height, referenceTimeMillisecond);
    }
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading