Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mVideoBw is zero when publisher device is in low network #48

Open
shahalRahman opened this issue May 21, 2020 · 0 comments
Open

mVideoBw is zero when publisher device is in low network #48

shahalRahman opened this issue May 21, 2020 · 0 comments

Comments

@shahalRahman
Copy link

When the publisher device is moved to low network(2G), SubscriberVideoStats.videoBytesReceived is coming same for around 30 seconds. And during this time mVideoBw is calculated to 0.

private void checkSubscriberVideoStats(SubscriberKit.SubscriberVideoStats stats) {
    double videoTimestamp = stats.timeStamp / 1000;

    Log.d(TAG, "onVideoStats: stats considering same_timestamp:" + (s_prevVideoTimestamp==videoTimestamp)+" same_byte:"+(stats.videoBytesReceived == s_prevVideoBytes));
    //initialize values
    if (s_prevVideoTimestamp == 0) {
        s_prevVideoTimestamp = videoTimestamp;
        s_prevVideoBytes = stats.videoBytesReceived;
    }

    if (videoTimestamp - s_prevVideoTimestamp >= TIME_WINDOW) {
        //calculate video packets lost ratio
        if (s_prevVideoPacketsRcvd != 0) {
            long pl = stats.videoPacketsLost - s_prevVideoPacketsLost;
            long pr = stats.videoPacketsReceived - s_prevVideoPacketsRcvd;
            long pt = pl + pr;

            if (pt > 0) {
                s_videoPLRatio = (double) pl / (double) pt;
            }
        }
        s_prevVideoPacketsLost = stats.videoPacketsLost;
        s_prevVideoPacketsRcvd = stats.videoPacketsReceived;

        long mVideoBw = (long) ((8 * (stats.videoBytesReceived - s_prevVideoBytes)) / (videoTimestamp - s_prevVideoTimestamp));

        s_prevVideoTimestamp = videoTimestamp;
        s_prevVideoBytes = stats.videoBytesReceived;
        if (s_videoPLRatio > 0) {
            s_avgVideoPLRatio = (s_videoPLRatio + s_avgVideoPLRatio) / 2;
        } else {
            s_avgVideoPLRatio = s_videoPLRatio;
        }
        if (mVideoBw > 0) {
            s_avgVideoBw = (mVideoBw + s_avgVideoBw) / 2;
        } else {
            s_avgVideoBw = mVideoBw;
        }
        Log.d(TAG, "onVideoStats: stats considering avgVideoBw:" + s_avgVideoBw + " PLRatio:" + s_avgVideoPLRatio + " BytesReceived:" + stats.videoBytesReceived + " PacketsReceived:" + stats.videoPacketsReceived + " PacketsLost:" + stats.videoPacketsLost + " mVideoBw:" + mVideoBw);

    }

}

We're using v2.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant