VT: ARTPConnection: added an event to notify first-rtcp packet.

[Related JIRA] RAMEN9610-4400

[Problem] Call downgrade is not triggered from UE if there is no
rtcp packet received even call is started long time ago.

[Cause] There is no logic for auto-downgrade if there is no any single packet.

[Solution] A new logic for auto-downgrade implemented both
StagefrightPlayer and IMSService.

Bug: 121230209
Change-Id: I44bf7131ba2cdb7a1c8760b62ea81427b43afcb1
Signed-off-by: Byeongjo Park <bjo.park@samsung.com>
diff --git a/media/libmediaplayerservice/nuplayer/RTPSource.cpp b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
index 57b6c59..d4d5bef 100644
--- a/media/libmediaplayerservice/nuplayer/RTPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
@@ -382,7 +382,7 @@
             }
 
             int32_t IMSRxNotice;
-            if (msg->findInt32("IMS-Rx-notice", &IMSRxNotice)) {
+            if (msg->findInt32("rtcp-event", &IMSRxNotice)) {
                 int32_t payloadType, feedbackType;
                 CHECK(msg->findInt32("payload-type", &payloadType));
                 CHECK(msg->findInt32("feedback-type", &feedbackType));
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index 01e22a3..ffcb30a 100644
--- a/media/libstagefright/rtsp/ARTPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTPConnection.cpp
@@ -410,7 +410,7 @@
             if (err == -ECONNRESET) {
                 // socket failure, this stream is dead, Jim.
                 sp<AMessage> notify = it->mNotifyMsg->dup();
-                notify->setInt32("IMS-Rx-notice", 1);
+                notify->setInt32("rtcp-event", 1);
                 notify->setInt32("payload-type", 400);
                 notify->setInt32("feedback-type", 1);
                 notify->setInt32("sender", it->mSources.valueAt(0)->getSelfID());
@@ -714,6 +714,13 @@
         sp<AMessage> notify = s->mNotifyMsg->dup();
         notify->setInt32("first-rtcp", true);
         notify->post();
+
+        ALOGI("send first-rtcp event to upper layer as ImsRxNotice");
+        sp<AMessage> imsNotify = s->mNotifyMsg->dup();
+        imsNotify->setInt32("rtcp-event", 1);
+        imsNotify->setInt32("payload-type", 101);
+        imsNotify->setInt32("feedback-type", 0);
+        imsNotify->post();
     }
 
     const uint8_t *data = buffer->data();
@@ -900,7 +907,7 @@
                         MxTBRMantissa, MxTBRExp, bitRate);
 
                 sp<AMessage> notify = s->mNotifyMsg->dup();
-                notify->setInt32("IMS-Rx-notice", 1);
+                notify->setInt32("rtcp-event", 1);
                 notify->setInt32("payload-type", 205);
                 notify->setInt32("feedback-type", msgType);
                 notify->setInt32("sender", id);
@@ -938,7 +945,7 @@
         {
             CHECK(size == 0);   // PLI does not need parameters
             sp<AMessage> notify = s->mNotifyMsg->dup();
-            notify->setInt32("IMS-Rx-notice", 1);
+            notify->setInt32("rtcp-event", 1);
             notify->setInt32("payload-type", 206);
             notify->setInt32("feedback-type", msgType);
             notify->setInt32("sender", id);
@@ -951,7 +958,7 @@
             uint32_t requestedId = u32at(&data[12]);
             if (requestedId == (uint32_t)mSelfID) {
                 sp<AMessage> notify = s->mNotifyMsg->dup();
-                notify->setInt32("IMS-Rx-notice", 1);
+                notify->setInt32("rtcp-event", 1);
                 notify->setInt32("payload-type", 206);
                 notify->setInt32("feedback-type", msgType);
                 notify->setInt32("sender", id);
@@ -1039,7 +1046,7 @@
                 source->addTMMBR(buffer);
                 if (source->isNeedToDowngrade()) {
                     sp<AMessage> notify = s->mNotifyMsg->dup();
-                    notify->setInt32("IMS-Rx-notice", 1);
+                    notify->setInt32("rtcp-event", 1);
                     notify->setInt32("payload-type", 400);
                     notify->setInt32("feedback-type", 1);
                     notify->setInt32("sender", source->getSelfID());
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 7f025a5..0fdf431 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -1032,6 +1032,11 @@
                     break;
                 }
 
+                int32_t rtcpEvent;
+                if (msg->findInt32("rtcp-event", &rtcpEvent)) {
+                    break;
+                }
+
                 ++mNumAccessUnitsReceived;
                 postAccessUnitTimeoutCheck();