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

Commit 45f6d079 authored by Jainishkumar Anghan's avatar Jainishkumar Anghan Committed by hsiaoanhsu
Browse files

VT: ECN implementation.



[Problem] ecn value needs to be updated but there is no interface
  to update the ecn value.
[Solution]
  1. Implement interface to set ecn value into socket by
     setsockopt(). ecn value will be taking care by upper layer.
  2. Configured rx socket to get TOS header then from that extract
      ECN bits and based on CE bit handle the bitrate using TMMBR.

Bug: 216214250
Test: manual

Change-Id: I332803190c3e170fee183d15dfe2d49c36007aff
Signed-off-by: default avatarJainishkumar Anghan <jai.anghan@samsung.com>
parent 3d316f37
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ StagefrightRecorder::StagefrightRecorder(const AttributionSourceState& client)
      mRTPCVOExtMap(-1),
      mRTPCVODegrees(0),
      mRTPSockDscp(0),
      mRTPSockOptEcn(0),
      mRTPSockNetwork(0),
      mLastSeqNo(0),
      mStarted(false),
@@ -910,6 +911,13 @@ status_t StagefrightRecorder::setSocketNetwork(int64_t networkHandle) {
    return OK;
}

status_t StagefrightRecorder::setParamRtpEcn(int32_t ecn) {
    ALOGV("setParamRtpEcn: %d", ecn);

    mRTPSockOptEcn = ecn;
    return OK;
}

status_t StagefrightRecorder::requestIDRFrame() {
    status_t ret = BAD_VALUE;
    if (mVideoEncoderSource != NULL) {
@@ -1091,6 +1099,11 @@ status_t StagefrightRecorder::setParameter(
        if (safe_strtoi32(value.string(), &dscp)) {
            return setParamRtpDscp(dscp);
        }
    } else if (key == "rtp-param-set-socket-ecn") {
        int32_t targetEcn;
        if (safe_strtoi32(value.string(), &targetEcn)) {
            return setParamRtpEcn(targetEcn);
        }
    } else if (key == "rtp-param-set-socket-network") {
        int64_t networkHandle;
        if (safe_strtoi64(value.string(), &networkHandle)) {
@@ -1272,6 +1285,9 @@ status_t StagefrightRecorder::start() {
            if (mRTPSockDscp > 0) {
                meta->setInt32(kKeyRtpDscp, mRTPSockDscp);
            }
            if (mRTPSockOptEcn > 0) {
                meta->setInt32(kKeyRtpEcn, mRTPSockOptEcn);
            }

            status = mWriter->start(meta.get());
            break;
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ private:
    int32_t mRTPCVOExtMap;
    int32_t mRTPCVODegrees;
    int32_t mRTPSockDscp;
    int32_t mRTPSockOptEcn;
    int64_t mRTPSockNetwork;
    uint32_t mLastSeqNo;

@@ -247,6 +248,7 @@ private:
    status_t setRTPCVOExtMap(int32_t extmap);
    status_t setRTPCVODegrees(int32_t cvoDegrees);
    status_t setParamRtpDscp(int32_t dscp);
    status_t setParamRtpEcn(int32_t ecn);
    status_t setSocketNetwork(int64_t networkHandle);
    status_t requestIDRFrame();
    void clipVideoBitRate();
+5 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ void NuPlayer::RTPSource::prepareAsync() {

        int sockRtp, sockRtcp;
        ARTPConnection::MakeRTPSocketPair(&sockRtp, &sockRtcp, info->mLocalIp, info->mRemoteIp,
                info->mLocalPort, info->mRemotePort, info->mSocketNetwork);
                info->mLocalPort, info->mRemotePort, info->mSocketNetwork, info->mRtpSockOptEcn);

        sp<AMessage> notify = new AMessage('accu', this);

@@ -125,6 +125,8 @@ void NuPlayer::RTPSource::prepareAsync() {
        mRTPConn->addStream(sockRtp, sockRtcp, desc, i + 1, notify, false);
        mRTPConn->setSelfID(info->mSelfID);
        mRTPConn->setStaticJitterTimeMs(info->mJbTimeMs);
        mRTPConn->setRtpSockOptEcn(info->mRtpSockOptEcn);
        mRTPConn->setIsIPv6(info->mLocalIp);

        unsigned long PT;
        AString formatDesc, formatParams;
@@ -719,6 +721,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-set-socket-ecn") {
        info->mRtpSockOptEcn = atoi(value);
    } else if (key == "rtp-param-jitter-buffer-time") {
        // clamping min at 40, max at 3000
        info->mJbTimeMs = std::min(std::max(40, atoi(value)), 3000);
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ private:
        uint32_t mSelfID;
        /* extmap:<value> for CVO will be set to here */
        int32_t mCVOExtMap;
        /* To check ECN is supported or not */
        int32_t mRtpSockOptEcn;

        /* a copy of TrackInfo in RTSPSource */
        sp<AnotherPacketSource> mSource;
+1 −0
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ enum {
    kKeyRtpExtMap        = 'extm', // int32_t, rtp extension ID for cvo on RTP protocol.
    kKeyRtpCvoDegrees    = 'cvod', // int32_t, rtp cvo degrees as per 3GPP 26.114.
    kKeyRtpDscp          = 'dscp', // int32_t, DSCP(Differentiated services codepoint) of RFC 2474.
    kKeyRtpEcn           = 'sEcn', // int32_t, ECN (Explicit Congestion Notification) of RFC 3168
    kKeySocketNetwork    = 'sNet', // int64_t, socket will be bound to network handle.

    // Slow-motion markers
Loading