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

Commit 2b85f7d9 authored by Byeongjo Park's avatar Byeongjo Park Committed by Lajos Molnar
Browse files

VT: SFR: bind socket to specific network.



This will call an API of android_setsocknetwork().

"rtp-param-set-socket-network" is added to update routing table
from media engine of android.

RTP/RTCP sockets will be bound to the networkhandle provided
through the above parameter.

This patch is effected only for Tx(StagefrightRecorder) session.
Rx(NuPlayer) is not implemented yet.

Merged-in: I5443e2071906576783db995421f997af5bc84424
Change-Id: I5443e2071906576783db995421f997af5bc84424
Signed-off-by: default avatarByeongjo Park <bjo.park@samsung.com>
parent 19c59686
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ cc_library {
        "android.hardware.media.c2@1.0",
        "android.hardware.media.omx@1.0",
        "libbase",
        "libandroid",
        "libandroid_net",
        "libaudioclient",
        "libbinder",
        "libcamera_client",
+17 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ StagefrightRecorder::StagefrightRecorder(const String16 &opPackageName)
      mVideoSource(VIDEO_SOURCE_LIST_END),
      mRTPCVOExtMap(-1),
      mRTPCVODegrees(0),
      mRTPSockNetwork(0),
      mLastSeqNo(0),
      mStarted(false),
      mSelectedDeviceId(AUDIO_PORT_HANDLE_NONE),
@@ -877,6 +878,16 @@ status_t StagefrightRecorder::setRTPCVODegrees(int32_t cvoDegrees) {
    return OK;
}

status_t StagefrightRecorder::setSocketNetwork(int64_t networkHandle) {
    ALOGV("setSocketNetwork: %llu", (unsigned long long) networkHandle);

    mRTPSockNetwork = networkHandle;
    if (mStarted && mOutputFormat == OUTPUT_FORMAT_RTP_AVP) {
        mWriter->updateSocketNetwork(mRTPSockNetwork);
    }
    return OK;
}

status_t StagefrightRecorder::requestIDRFrame() {
    status_t ret = BAD_VALUE;
    if (mVideoEncoderSource != NULL) {
@@ -1038,6 +1049,11 @@ status_t StagefrightRecorder::setParameter(
        }
    } else if (key == "video-param-request-i-frame") {
        return requestIDRFrame();
    } else if (key == "rtp-param-set-socket-network") {
        int64_t networkHandle;
        if (safe_strtoi64(value.string(), &networkHandle)) {
            return setSocketNetwork(networkHandle);
        }
    } else {
        ALOGE("setParameter: failed to find key %s", key.string());
    }
@@ -1206,6 +1222,7 @@ status_t StagefrightRecorder::start() {
            meta->setInt64(kKeyTime, startTimeUs);
            meta->setInt32(kKeySelfID, mSelfID);
            meta->setInt32(kKeyPayloadType, mPayloadType);
            meta->setInt64(kKeySocketNetwork, mRTPSockNetwork);
            if (mRTPCVOExtMap > 0) {
                meta->setInt32(kKeyRtpExtMap, mRTPCVOExtMap);
                meta->setInt32(kKeyRtpCvoDegrees, mRTPCVODegrees);
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ private:
    int32_t mPayloadType;
    int32_t mRTPCVOExtMap;
    int32_t mRTPCVODegrees;
    int64_t mRTPSockNetwork;
    uint32_t mLastSeqNo;

    int64_t mDurationRecordedUs;
@@ -240,6 +241,7 @@ private:
    status_t setParamPayloadType(int32_t payloadType);
    status_t setRTPCVOExtMap(int32_t extmap);
    status_t setRTPCVODegrees(int32_t cvoDegrees);
    status_t setSocketNetwork(int64_t networkHandle);
    status_t requestIDRFrame();
    void clipVideoBitRate();
    void clipVideoFrameRate();
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ struct MediaWriter : public RefBase {
    virtual status_t setNextFd(int /*fd*/) { return INVALID_OPERATION; }
    virtual void updateCVODegrees(int32_t /*cvoDegrees*/) {}
    virtual void updatePayloadType(int32_t /*payloadType*/) {}
    virtual void updateSocketNetwork(int64_t /*socketNetwork*/) {}
    virtual uint32_t getSequenceNum() { return 0; }

protected:
+1 −0
Original line number Diff line number Diff line
@@ -253,6 +253,7 @@ enum {
    kKeyPayloadType      = 'pTyp', // int32_t, SDP negotiated payload type.
    kKeyRtpExtMap        = 'extm', // int32_t, rtp extension ID for cvo on RTP protocol.
    kKeyRtpCvoDegrees    = 'cvod', // int32_t, rtp cvo degrees as per 3GPP 26.114.
    kKeySocketNetwork    = 'sNet', // int64_t, socket will be bound to network handle.
};

enum {
Loading