Skip to content

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

@shahalRahman

Description

@shahalRahman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions