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

Commit 0175f4e1 authored by Somraj Mani's avatar Somraj Mani Committed by Lajos Molnar
Browse files

VT: Recorder gets payload type value from param



Removes hardcoded payload type in ARTPWriter.

A payload type will be assigned dynamically by an
upper layer as per SDP negotation.

Merged-in: I7c6f244c753c84a7954261b1c37292083ab5996a
Change-Id: I7c6f244c753c84a7954261b1c37292083ab5996a
Signed-off-by: default avatarSomraj Mani <som.mani@samsung.com>
Signed-off-by: default avatarKim Sungyeon <sy85.kim@samsung.com>
parent fc88be84
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -825,6 +825,13 @@ status_t StagefrightRecorder::setParamSelfID(int32_t selfID) {
    return OK;
}

status_t StagefrightRecorder::setParamPayloadType(int32_t payloadType) {
    ALOGV("setParamPayloadType: %x", payloadType);

    mPayloadType = payloadType;
    return OK;
}

status_t StagefrightRecorder::setParameter(
        const String8 &key, const String8 &value) {
    ALOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
@@ -954,6 +961,11 @@ status_t StagefrightRecorder::setParameter(
            selfID = static_cast<int32_t>(temp);
            return setParamSelfID(selfID);
        }
    } else if (key == "rtp-param-payload-type") {
        int32_t payloadType;
        if (safe_strtoi32(value.string(), &payloadType)) {
            return setParamPayloadType(payloadType);
        }
    } else {
        ALOGE("setParameter: failed to find key %s", key.string());
    }
@@ -1121,6 +1133,7 @@ status_t StagefrightRecorder::start() {
            int64_t startTimeUs = systemTime() / 1000;
            meta->setInt64(kKeyTime, startTimeUs);
            meta->setInt32(kKeySelfID, mSelfID);
            meta->setInt32(kKeyPayloadType, mPayloadType);
            status = mWriter->start(meta.get());
            break;
        }
+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ private:
    int32_t mLocalPort;
    int32_t mRemotePort;
    int32_t mSelfID;
    int32_t mPayloadType;

    int64_t mDurationRecordedUs;
    int64_t mStartedRecordingUs;
@@ -229,6 +230,7 @@ private:
    status_t setParamRtpRemoteIp(const String8 &remoteIp);
    status_t setParamRtpRemotePort(int32_t remotePort);
    status_t setParamSelfID(int32_t selfID);
    status_t setParamPayloadType(int32_t payloadType);
    void clipVideoBitRate();
    void clipVideoFrameRate();
    void clipVideoFrameWidth();
+1 −0
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ enum {
    kKeySps              = 'sSps', // int32_t, indicates that a buffer is sps.
    kKeyPps              = 'sPps', // int32_t, indicates that a buffer is pps.
    kKeySelfID           = 'sfid', // int32_t, source ID to identify itself on RTP protocol.
    kKeyPayloadType      = 'pTyp', // int32_t, SDP negotiated payload type.
};

enum {
+14 −7
Original line number Diff line number Diff line
@@ -206,6 +206,13 @@ status_t ARTPWriter::start(MetaData * params) {
    if(params->findInt32(kKeySelfID, &selfID))
        mSourceID = selfID;

    if (mPayloadType == 0)
        mPayloadType = PT;

    int32_t payloadType = 0;
    if(params->findInt32(kKeyPayloadType, &payloadType))
        mPayloadType = payloadType;

    mMode = INVALID;
    if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) {
        mMode = H264;
@@ -760,7 +767,7 @@ void ARTPWriter::sendHEVCData(MediaBufferBase *mediaBuf) {
        // The data fits into a single packet
        uint8_t *data = buffer->data();
        data[0] = 0x80;
        data[1] = (1 << 7) | PT;  // M-bit
        data[1] = (1 << 7) | mPayloadType;  // M-bit
        data[2] = (mSeqNo >> 8) & 0xff;
        data[3] = mSeqNo & 0xff;
        data[4] = rtpTime >> 24;
@@ -802,7 +809,7 @@ void ARTPWriter::sendHEVCData(MediaBufferBase *mediaBuf) {

            uint8_t *data = buffer->data();
            data[0] = 0x80;
            data[1] = (lastPacket ? (1 << 7) : 0x00) | PT;  // M-bit
            data[1] = (lastPacket ? (1 << 7) : 0x00) | mPayloadType;  // M-bit
            data[2] = (mSeqNo >> 8) & 0xff;
            data[3] = mSeqNo & 0xff;
            data[4] = rtpTime >> 24;
@@ -892,9 +899,9 @@ void ARTPWriter::sendAVCData(MediaBufferBase *mediaBuf) {
        uint8_t *data = buffer->data();
        data[0] = 0x80;
        if (isSpsPps)
            data[1] = PT;  // Marker bit should not be set in case of sps/pps
            data[1] = mPayloadType;  // Marker bit should not be set in case of sps/pps
        else
            data[1] = (1 << 7) | PT;
            data[1] = (1 << 7) | mPayloadType;
        data[2] = (mSeqNo >> 8) & 0xff;
        data[3] = mSeqNo & 0xff;
        data[4] = rtpTime >> 24;
@@ -935,7 +942,7 @@ void ARTPWriter::sendAVCData(MediaBufferBase *mediaBuf) {

            uint8_t *data = buffer->data();
            data[0] = 0x80;
            data[1] = (lastPacket ? (1 << 7) : 0x00) | PT;  // M-bit
            data[1] = (lastPacket ? (1 << 7) : 0x00) | mPayloadType;  // M-bit
            data[2] = (mSeqNo >> 8) & 0xff;
            data[3] = mSeqNo & 0xff;
            data[4] = rtpTime >> 24;
@@ -1006,7 +1013,7 @@ void ARTPWriter::sendH263Data(MediaBufferBase *mediaBuf) {

        uint8_t *data = buffer->data();
        data[0] = 0x80;
        data[1] = (lastPacket ? 0x80 : 0x00) | PT;  // M-bit
        data[1] = (lastPacket ? 0x80 : 0x00) | mPayloadType;  // M-bit
        data[2] = (mSeqNo >> 8) & 0xff;
        data[3] = mSeqNo & 0xff;
        data[4] = rtpTime >> 24;
@@ -1088,7 +1095,7 @@ void ARTPWriter::sendAMRData(MediaBufferBase *mediaBuf) {
    // The data fits into a single packet
    uint8_t *data = buffer->data();
    data[0] = 0x80;
    data[1] = PT;
    data[1] = mPayloadType;
    if (mNumRTPSent == 0) {
        // Signal start of talk-spurt.
        data[1] |= 0x80;  // M-bit
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ private:
    MediaBufferBase *mPPSBuf;

    uint32_t mSourceID;
    uint32_t mPayloadType;
    uint32_t mSeqNo;
    uint32_t mRTPTimeBase;
    uint32_t mNumRTPSent;