VT: Add RTCP feedback message(TSFB & PSFB) parser to RTP source

Parser for RTCP feedback messages (Refer RFC 4585 Ch.6)

1. Parser for TranSport layer FeedBack messages. (Refer RFC 5104 Ch.4)
   Bitrate value in TMMBR & TMMBN  must be passed on to Recorder(Tx) part for congestion control.

2. Parser for Payload-Specific FeedBack messages (Refer RFC 4585 Ch.6)
   Supports PLI(Packet Loss Indication) notification.

The value & notification are passed through ARTPConnection -> RTPSource -> NuPlayer -> JAVA layer

Bug: 121230209
Change-Id: I85bfa0c359a60b42bcdf062f8a158db2ce69aa5a
Signed-off-by: Kim Sungyeon <sy85.kim@samsung.com>
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 8b585b1..3c4a96b 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -2727,6 +2727,14 @@
             break;
         }
 
+        case Source::kWhatIMSRxNotice:
+        {
+            sp<AMessage> IMSRxNotice;
+            CHECK(msg->findMessage("message", &IMSRxNotice));
+            sendIMSRxNotice(IMSRxNotice);
+            break;
+        }
+
         default:
             TRESPASS();
     }
@@ -2829,6 +2837,38 @@
     }
 }
 
+void NuPlayer::sendIMSRxNotice(const sp<AMessage> &msg) {
+    int32_t notice, payloadType, feedbackType, id, bitrate;
+
+    CHECK(msg->findInt32("IMS-Rx-notice", &notice));
+    CHECK(msg->findInt32("payload-type", &payloadType));
+    CHECK(msg->findInt32("feedback-type", &feedbackType));
+    CHECK(msg->findInt32("sender", &id));
+
+    Parcel in;
+    in.writeInt32(payloadType);
+    in.writeInt32(feedbackType);
+    in.writeInt32(id);
+
+    switch (payloadType) {
+        case 205:   // TSFB
+        {
+            CHECK(msg->findInt32("bit-rate", &bitrate));
+            in.writeInt32(bitrate);
+            break;
+        }
+        case 206:   // PSFB
+        {
+            // nothing to do yet
+            break;
+        }
+        default:
+        break;
+    }
+
+    notifyListener(MEDIA_IMS_RX_NOTICE, 0, 0, &in);
+}
+
 const char *NuPlayer::getDataSourceType() {
     switch (mDataSourceType) {
         case DATA_SOURCE_TYPE_HTTP_LIVE:
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index f316096..c96ad31 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -337,6 +337,7 @@
     void sendSubtitleData(const sp<ABuffer> &buffer, int32_t baseIndex);
     void sendTimedMetaData(const sp<ABuffer> &buffer);
     void sendTimedTextData(const sp<ABuffer> &buffer);
+    void sendIMSRxNotice(const sp<AMessage> &msg);
 
     void writeTrackInfo(Parcel* reply, const sp<AMessage>& format) const;
 
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
index f137c52..eb39870 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
@@ -58,6 +58,7 @@
         kWhatInstantiateSecureDecoders,
         // Modular DRM
         kWhatDrmInfo,
+        kWhatIMSRxNotice,
     };
 
     // The provides message is used to notify the player about various
diff --git a/media/libmediaplayerservice/nuplayer/RTPSource.cpp b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
index de1f8a1..9bb4cb7 100644
--- a/media/libmediaplayerservice/nuplayer/RTPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
@@ -356,6 +356,22 @@
                 break;
             }
 
+            int32_t IMSRxNotice;
+            if (msg->findInt32("IMS-Rx-notice", &IMSRxNotice)) {
+                int32_t payloadType, feedbackType;
+                CHECK(msg->findInt32("payload-type", &payloadType));
+                CHECK(msg->findInt32("feedback-type", &feedbackType));
+
+                sp<AMessage> notify = dupNotify();
+                notify->setInt32("what", kWhatIMSRxNotice);
+                notify->setMessage("message", msg);
+                notify->post();
+
+                ALOGV("IMSRxNotice \t\t payload : %d feedback : %d",
+                      payloadType, feedbackType);
+                break;
+            }
+
             size_t trackIndex;
             CHECK(msg->findSize("trackIndex", &trackIndex));