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

Commit d42c50d4 authored by Kim Sungyeon's avatar Kim Sungyeon Committed by Lajos Molnar
Browse files

VT: Add auto downgrade function



Some network requires force-downgrading to audio call when video packet status is bad.

1. ARTPSource reports bitrate value for every unit time.
   If low bitrate duration stays long, ARTPConnection triggers auto downgrading message.
   The way of passing message is same as TSFB & PSFB.

2. Add auto downgrade callback message when connection lost.

Merged-in: I04e3f4e1955852c61540f35c763a40be3e7b639b
Change-Id: I04e3f4e1955852c61540f35c763a40be3e7b639b
Signed-off-by: default avatarKim Sungyeon <sy85.kim@samsung.com>
parent a2c250d2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2848,6 +2848,7 @@ void NuPlayer::sendIMSRxNotice(const sp<AMessage> &msg) {
    switch (payloadType) {
        case NuPlayer::RTPSource::RTCP_TSFB:   // RTCP TSFB
        case NuPlayer::RTPSource::RTCP_PSFB:   // RTCP PSFB
        case NuPlayer::RTPSource::RTP_AUTODOWN:
        {
            int32_t feedbackType, id;
            CHECK(msg->findInt32("feedback-type", &feedbackType));
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ struct NuPlayer::RTPSource : public NuPlayer::Source {
        RTCP_TSFB = 205,
        RTCP_PSFB = 206,
        RTP_CVO = 300,
        RTP_AUTODOWN = 400,
    };

    virtual status_t getBufferingSettings(
+15 −0
Original line number Diff line number Diff line
@@ -416,6 +416,12 @@ void ARTPConnection::onPollStreams() {

            if (err == -ECONNRESET) {
                // socket failure, this stream is dead, Jim.
                sp<AMessage> notify = it->mNotifyMsg->dup();
                notify->setInt32("IMS-Rx-notice", 1);
                notify->setInt32("payload-type", 400);
                notify->setInt32("feedback-type", 1);
                notify->setInt32("sender", it->mSources.valueAt(0)->getSelfID());
                notify->post();

                ALOGW("failed to receive RTP/RTCP datagram.");
                it = mStreams.erase(it);
@@ -1016,8 +1022,17 @@ void ARTPConnection::checkRxBitrate(int64_t nowUs) {

            for (size_t i = 0; i < s->mSources.size(); ++i) {
                sp<ARTPSource> source = s->mSources.valueAt(i);
                source->setBitrateData(bitrate, nowUs);
                source->setTargetBitrate();
                source->addTMMBR(buffer);
                if (source->isNeedToDowngrade()) {
                    sp<AMessage> notify = s->mNotifyMsg->dup();
                    notify->setInt32("IMS-Rx-notice", 1);
                    notify->setInt32("payload-type", 400);
                    notify->setInt32("feedback-type", 1);
                    notify->setInt32("sender", source->getSelfID());
                    notify->post();
                }
            }
            if (buffer->size() > 0) {
                ALOGV("Sending TMMBR...");
+8 −0
Original line number Diff line number Diff line
@@ -379,6 +379,10 @@ void ARTPSource::setMinMaxBitrate(int32_t min, int32_t max) {
    mQualManager.setMinMaxBitrate(min, max);
}

void ARTPSource::setBitrateData(int32_t bitrate, int64_t time) {
    mQualManager.setBitrateData(bitrate, time);
}

void ARTPSource::setTargetBitrate() {
    uint8_t fraction = 0;

@@ -403,6 +407,10 @@ bool ARTPSource::isNeedToReport() {
    return (intervalReceived > 0) ? true : false;
}

bool ARTPSource::isNeedToDowngrade() {
    return mQualManager.isNeedToDowngrade();
}

void ARTPSource::noticeAbandonBuffer(int cnt) {
    mNumBuffersReceived -= cnt;
}
+2 −0
Original line number Diff line number Diff line
@@ -50,9 +50,11 @@ struct ARTPSource : public RefBase {
    uint32_t getSelfID();
    void setSelfID(const uint32_t selfID);
    void setMinMaxBitrate(int32_t min, int32_t max);
    void setBitrateData(int32_t bitrate, int64_t time);
    void setTargetBitrate();

    bool isNeedToReport();
    bool isNeedToDowngrade();

    void noticeAbandonBuffer(int cnt=1);

Loading