Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75adcb7a authored by Byeongjo Park's avatar Byeongjo Park Committed by Lajos Molnar
Browse files

VT: Added an interface to set JitterBufferTime.



Jitter buffer time can be adjusted according to packet jitter
situation. Jitter buffer time will be decided by upper layer
and then RTP Assemblers just apply a value of jitter time.

Added an interface to set video-param-jitter-buffer-time.
 - Minimum jitter buffer time = 40ms.
 - Maximum jitter buffer time = 3000ms.

Bug: 144795638
Bug: 165061754
Merged-in: Idc6ef462a91aab87c3f0ad46c504ebf0b89c36c4
Change-Id: Idc6ef462a91aab87c3f0ad46c504ebf0b89c36c4
Signed-off-by: default avatarByeongjo Park <bjo.park@samsung.com>
parent e0864615
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ void NuPlayer::RTPSource::prepareAsync() {
        // index(i) should be started from 1. 0 is reserved for [root]
        mRTPConn->addStream(sockRtp, sockRtcp, desc, i + 1, notify, false);
        mRTPConn->setSelfID(info->mSelfID);
        mRTPConn->setJbTime((info->mJbTime <= 3000 && info->mJbTime >= 40) ? info->mJbTime : 300);
        mRTPConn->setMinMaxBitrate(kMinVideoBitrate, info->mAS * 1000 /* kbps */);

        info->mRTPSocket = sockRtp;
@@ -656,6 +657,7 @@ status_t NuPlayer::RTPSource::setParameter(const String8 &key, const String8 &va
        newTrackInfo.mIsAudio = isAudioKey;
        mTracks.push(newTrackInfo);
        info = &mTracks.editTop();
        info->mJbTime = 300;
    }

    if (key == "rtp-param-mime-type") {
@@ -698,6 +700,8 @@ status_t NuPlayer::RTPSource::setParameter(const String8 &key, const String8 &va
    } else if (key == "rtp-param-set-socket-network") {
        int64_t networkHandle = atoll(value);
        setSocketNetwork(networkHandle);
    } else if (key == "rtp-param-jitter-buffer-time") {
        info->mJbTime = atoi(value);
    }

    return OK;
+2 −0
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@ private:
        int32_t mTimeScale;
        int32_t mAS;

        /* RTP jitter buffer time in millsecond */
        uint32_t mJbTime;
        /* Unique ID indicates itself */
        uint32_t mSelfID;
        /* extmap:<value> for CVO will be set to here */
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
    int64_t playedTime = nowTime - startTime;
    int32_t playedTimeRtp = source->mFirstRtpTime +
        (((uint32_t)playedTime) * (source->mClockRate / 1000));
    const int32_t jitterTime = source->mClockRate / 5;  // 200ms
    const int32_t jitterTime = (int32_t)(source->mClockRate / ((float)1000 / (source->mJbTime)));
    int32_t expiredTimeInJb = rtpTime + jitterTime;
    bool isExpired = expiredTimeInJb <= (playedTimeRtp);
    bool isTooLate200 = expiredTimeInJb < (playedTimeRtp - jitterTime);
+7 −1
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ ARTPConnection::ARTPConnection(uint32_t flags)
    : mFlags(flags),
      mPollEventPending(false),
      mLastReceiverReportTimeUs(-1),
      mLastBitrateReportTimeUs(-1) {
      mLastBitrateReportTimeUs(-1),
      mJbTime(300) {
}

ARTPConnection::~ARTPConnection() {
@@ -1020,6 +1021,7 @@ sp<ARTPSource> ARTPConnection::findSource(StreamInfo *info, uint32_t srcId) {
                srcId, info->mSessionDesc, info->mIndex, info->mNotifyMsg);

        source->setSelfID(mSelfID);
        source->setJbTime(mJbTime > 0 ? mJbTime : 300);
        source->setMinMaxBitrate(mMinBitrate, mMaxBitrate);
        info->mSources.add(srcId, source);
    } else {
@@ -1040,6 +1042,10 @@ void ARTPConnection::setSelfID(const uint32_t selfID) {
    mSelfID = selfID;
}

void ARTPConnection::setJbTime(const uint32_t jbTime) {
    mJbTime = jbTime;
}

void ARTPConnection::setMinMaxBitrate(int32_t min, int32_t max) {
    mMinBitrate = min;
    mMaxBitrate = max;
+4 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ struct ARTPConnection : public AHandler {
    void injectPacket(int index, const sp<ABuffer> &buffer);

    void setSelfID(const uint32_t selfID);
    void setJbTime(const uint32_t jbTime);
    void setMinMaxBitrate(int32_t min, int32_t max);

    // Creates a pair of UDP datagram sockets bound to adjacent ports
@@ -88,6 +89,9 @@ private:

    int32_t mMinBitrate;
    int32_t mMaxBitrate;

    uint32_t mJbTime;

    int32_t mCumulativeBytes;

    void onAddStream(const sp<AMessage> &msg);
Loading