简体   繁体   中英

Quickblox Improve video quality

I am getting very poor video quality using QuickBlox when the video is sent to the other device. For example, I see myself on my own device with very high quality, but once I look at the other device the quality of what is being received is very poor.

I tried increasing the FPS by using this:

 cameraView.setFPS(30);

What can I do to improve the quality of video that is received?

I tested these two tablets on Google Hangouts and the quality was better than my app.


This is the code that can be found on the Sample by QuickBlox .

public class ActivityVideoChat extends Activity 
{
    private CameraView cameraView;
    private OpponentGlSurfaceView opponentView;
    private ProgressBar opponentImageLoadingPb;
    private VideoChatConfig videoChatConfig;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_chat_layout);
        initViews();
    }

    private void initViews() 
    {
        Debugger.logConnection("initViews");

        opponentView = (OpponentGlSurfaceView) findViewById(R.id.opponentView);

        cameraView = (CameraView) findViewById(R.id.cameraView);
        cameraView.setCameraFrameProcess(true);
        cameraView.setQBVideoChatListener(qbVideoChatListener);

        cameraView.setFPS(30);
        cameraView.setOnCameraViewListener(new OnCameraViewListener() {
            @Override
            public void onCameraSupportedPreviewSizes(List<Camera.Size> supportedPreviewSizes) {
                Camera.Size firstFrameSize = supportedPreviewSizes.get(0);
                Camera.Size lastFrameSize = supportedPreviewSizes.get(supportedPreviewSizes.size() - 1);
                cameraView.setFrameSize(firstFrameSize.width > lastFrameSize.width ? lastFrameSize : firstFrameSize);
            }
        });

        opponentImageLoadingPb = (ProgressBar) findViewById(R.id.opponentImageLoading);

        videoChatConfig = getIntent().getParcelableExtra(VideoChatConfig.class.getCanonicalName());

        QBVideoChatController.getInstance().setQBVideoChatListener(DataHolder.getInstance().getCurrentQbUser(), qbVideoChatListener);
    }

    @Override
    protected void onResume() 
    {
        super.onResume();
        cameraView.reuseCameraView();
    }

    @Override
    protected void onPause() 
    {
        cameraView.closeCamera();
        super.onPause();
    }

    @Override
    public void onDestroy() 
    {
        QBVideoChatController.getInstance().finishVideoChat(videoChatConfig);
        super.onDestroy();
    }

    OnQBVideoChatListener qbVideoChatListener = new OnQBVideoChatListener() 
    {
        @Override
        public void onCameraDataReceive(byte[] videoData) 
        {
            if (videoChatConfig.getCallType() != CallType.VIDEO_AUDIO) 
            {
                return;
            }
            QBVideoChatController.getInstance().sendVideo(videoData);
        }

        @Override
        public void onMicrophoneDataReceive(byte[] audioData) 
        {
            QBVideoChatController.getInstance().sendAudio(audioData);
        }

        @Override
        public void onOpponentVideoDataReceive(byte[] videoData) 
        {
            opponentView.loadOpponentImage(videoData);
        }

        @Override
        public void onOpponentAudioDataReceive(byte[] audioData)
        {
            QBVideoChatController.getInstance().playAudio(audioData);
        }

        @Override
        public void onProgress(boolean progress) 
        {
            opponentImageLoadingPb.setVisibility(progress ? View.VISIBLE : View.GONE);
        }

        @Override
        public void onVideoChatStateChange(CallState callState, VideoChatConfig chat) 
        {
            switch (callState) 
            {
                case ON_CALL_START:
                    break;
                case ON_CANCELED_CALL:

                    finish();
                    break;
                case ON_CALL_END:
                    finish();
                    break;
            }
        }
    };
}

I'm actually unable to even receive video. Are you calling from android to android or android to ios?

Did you do anything special to get video to work? If so, can you please let me know what you did?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM