Skip to content

FPS too low getting 3-4fps on android device local server #141

@gmMustafa

Description

@gmMustafa

I have added the code to my project and everything is working fine, except the fps rate.
Although getting the same 3-4FPS on an emulator(video is a bit stable) but on a physical device 3-4fps are too lagy getting 5-7 seconds of delay and the video stuck on camera movement.

I have installed the ipCam app from the play store and creating a local server for stream.

layout XML:

    <com.github.niqdev.mjpeg.MjpegSurfaceView
        android:id="@+id/mjpegViewDefault"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        stream:type="stream_default" />

Here is how I have added it to my android activity:

    private void loadIpCam(String streamIdVal) {
        String url = "http://"+streamIdVal+"/video";
       textViewUrl.setText("Playing: "+url);

        Mjpeg.newInstance()
                .credential("", "")
                .open(url, TIMEOUT)
                .subscribe(
                        inputStream -> {
                            mjpegView.setSource(inputStream);
                            //mjpegView.setResolution(480,360);
                            mjpegView.setDisplayMode(DisplayMode.BEST_FIT);
                            mjpegView.showFps(true);
                            mjpegView.setRotate(90);

                        },
                        throwable -> {
                            Log.e(getClass().getSimpleName(), "mjpeg error", throwable);
                            Toast.makeText(this, "Error", Toast.LENGTH_LONG).show();
                        });
    }

for network security config I have added these configurations to my application in Android.manifest

    <application
     ...  
      android:networkSecurityConfig="@xml/network_security_config"
        ...>
</application>

network_security_config.xm file is:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions