VT: SFP: H264: CVO implementation for Rx side

CVO(Coordination of Video Orientation) implemented for H264.

Support Coordination of Video Orientation (CVO) feature that carried in RTP Header extension.
it parses a device degrees(orientation) in RTP extension that remote sent.
(6.2.3 of 3GPP Release 12 TS 26.114)

Once AAVCAssembler parsed a video degress from RTP(CVO) extension,
A native window will be rotated as per parsed video degress.

Bug: 121230209
Change-Id: I802a9e43d9ee54b7970d2541f18fb4af8022336a
Signed-off-by: Byeongjo Park <bjo.park@samsung.com>
Signed-off-by: Kim Sungyeon <sy85.kim@samsung.com>
diff --git a/media/libmediaplayerservice/nuplayer/RTPSource.cpp b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
index 6f4933c..e9e7d06 100644
--- a/media/libmediaplayerservice/nuplayer/RTPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTPSource.cpp
@@ -44,7 +44,8 @@
       mInPreparationPhase(true),
       mRTPConn(new ARTPConnection),
       mEOSTimeoutAudio(0),
-      mEOSTimeoutVideo(0) {
+      mEOSTimeoutVideo(0),
+      mLastCVOUpdated(-1) {
       ALOGD("RTPSource initialized with rtpParams=%s", rtpParams.string());
 }
 
@@ -92,7 +93,7 @@
         AString sdp;
         ASessionDescription::SDPStringFactory(sdp, info->mLocalIp,
                 info->mIsAudio, info->mLocalPort, info->mPayloadType, info->mAS, info->mCodecName,
-                NULL, info->mWidth, info->mHeight);
+                NULL, info->mWidth, info->mHeight, info->mCVOExtMap);
         ALOGD("RTPSource SDP =>\n%s", sdp.c_str());
 
         sp<ASessionDescription> desc = new ASessionDescription;
@@ -273,7 +274,29 @@
 
     setEOSTimeout(audio, 0);
 
-    return source->dequeueAccessUnit(accessUnit);
+    finalResult = source->dequeueAccessUnit(accessUnit);
+    if (finalResult != OK) {
+        return finalResult;
+    }
+
+    int32_t cvo;
+    if ((*accessUnit) != NULL && (*accessUnit)->meta()->findInt32("cvo", &cvo)) {
+        if (cvo != mLastCVOUpdated) {
+            sp<AMessage> msg = new AMessage();
+            msg->setInt32("payload-type", NuPlayer::RTPSource::RTP_CVO);
+            msg->setInt32("cvo", cvo);
+
+            sp<AMessage> notify = dupNotify();
+            notify->setInt32("what", kWhatIMSRxNotice);
+            notify->setMessage("message", msg);
+            notify->post();
+
+            ALOGV("notify cvo updated (%d)->(%d) to upper layer", mLastCVOUpdated, cvo);
+            mLastCVOUpdated = cvo;
+        }
+    }
+
+    return finalResult;
 }
 
 sp<AnotherPacketSource> NuPlayer::RTPSource::getSource(bool audio) {
@@ -666,6 +689,8 @@
     } else if (key == "rtp-param-time-scale") {
     } else if (key == "rtp-param-self-id") {
         info->mSelfID = atoi(value);
+    } else if (key == "rtp-param-ext-cvo-extmap") {
+        info->mCVOExtMap = atoi(value);
     }
 
     return OK;