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

Commit 426b650e authored by Andreas Huber's avatar Andreas Huber
Browse files

Specification of codec specific data as part of the session description is now optional.

Change-Id: Ie1953909e1d241381add3cc82a7a1f7d7d1540f2
parent 57648e4e
Loading
Loading
Loading
Loading
+2 −54
Original line number Diff line number Diff line
@@ -854,7 +854,7 @@ void AwesomePlayer::setVideoSource(sp<MediaSource> source) {

status_t AwesomePlayer::initVideoDecoder() {
    uint32_t flags = 0;
#if 1
#if 0
    if (mRTPSession != NULL) {
        // XXX hack.

@@ -1240,39 +1240,6 @@ status_t AwesomePlayer::finishSetDataSource_l() {
        mLooper->registerHandler(mRTPSession);

#if 0
        // My H264 SDP
        static const char *raw =
            "v=0\r\n"
            "o=- 64 233572944 IN IP4 127.0.0.0\r\n"
            "s=QuickTime\r\n"
            "t=0 0\r\n"
            "a=range:npt=0-315\r\n"
            "a=isma-compliance:2,2.0,2\r\n"
            "m=video 5434 RTP/AVP 97\r\n"
            "c=IN IP4 127.0.0.1\r\n"
            "b=AS:30\r\n"
            "a=rtpmap:97 H264/90000\r\n"
            "a=fmtp:97 packetization-mode=1;profile-level-id=42000C;"
              "sprop-parameter-sets=Z0IADJZUCg+I,aM44gA==\r\n"
            "a=mpeg4-esid:201\r\n"
            "a=cliprect:0,0,240,320\r\n"
            "a=framesize:97 320-240\r\n";
#elif 0
        // My H263 SDP
        static const char *raw =
            "v=0\r\n"
            "o=- 64 233572944 IN IP4 127.0.0.0\r\n"
            "s=QuickTime\r\n"
            "t=0 0\r\n"
            "a=range:npt=0-315\r\n"
            "a=isma-compliance:2,2.0,2\r\n"
            "m=video 5434 RTP/AVP 97\r\n"
            "c=IN IP4 127.0.0.1\r\n"
            "b=AS:30\r\n"
            "a=rtpmap:97 H263-1998/90000\r\n"
            "a=cliprect:0,0,240,320\r\n"
            "a=framesize:97 320-240\r\n";
#elif 0
        // My AMR SDP
        static const char *raw =
            "v=0\r\n"
@@ -1299,12 +1266,9 @@ status_t AwesomePlayer::finishSetDataSource_l() {
            "c=IN IP4 127.0.0.1\r\n"
            "b=AS:30\r\n"
            "a=rtpmap:97 H264/90000\r\n"
            "a=fmtp:97 packetization-mode=1;profile-level-id=42E00D;"
              "sprop-parameter-sets=J0LgDZWgUG/lQA==,KM4DnoA=\r\n"
            "a=mpeg4-esid:201\r\n"
            "a=cliprect:0,0,200,320\r\n"
            "a=framesize:97 320-200\r\n";
#elif 0
#else
        // GTalk H263 SDP
        static const char *raw =
            "v=0\r\n"
@@ -1319,22 +1283,6 @@ status_t AwesomePlayer::finishSetDataSource_l() {
            "a=rtpmap:98 H263-1998/90000\r\n"
            "a=cliprect:0,0,200,320\r\n"
            "a=framesize:98 320-200\r\n";
#else
    // sholes H264 SDP
    static const char *raw =
        "v=0\r\n"
        "o=- 64 233572944 IN IP4 127.0.0.0\r\n"
        "s=QuickTime\r\n"
        "t=0 0\r\n"
        "a=range:npt=now-\r\n"
        "m=video 5434 RTP/AVP 96\r\n"
        "c=IN IP4 127.0.0.1\r\n"
        "b=AS:320000\r\n"
        "a=rtpmap:96 H264/90000\r\n"
        "a=fmtp:96 packetization-mode=1;profile-level-id=42001E;"
          "sprop-parameter-sets=Z0KACukCg+QgAAB9AAAOpgCA,aM48gA==\r\n"
        "a=cliprect:0,0,240,320\r\n"
        "a=framesize:96 320-240\r\n";
#endif

        sp<ASessionDescription> desc = new ASessionDescription;
+12 −5
Original line number Diff line number Diff line
@@ -92,7 +92,9 @@ static sp<ABuffer> decodeHex(const AString &s) {

static sp<ABuffer> MakeAVCCodecSpecificData(const char *params) {
    AString val;
    CHECK(GetAttribute(params, "profile-level-id", &val));
    if (!GetAttribute(params, "profile-level-id", &val)) {
        return NULL;
    }

    sp<ABuffer> profileLevelID = decodeHex(val);
    CHECK(profileLevelID != NULL);
@@ -105,7 +107,10 @@ static sp<ABuffer> MakeAVCCodecSpecificData(const char *params) {
    size_t numPicParameterSets = 0;
    size_t totalPicParameterSetSize = 0;

    CHECK(GetAttribute(params, "sprop-parameter-sets", &val));
    if (!GetAttribute(params, "sprop-parameter-sets", &val)) {
        return NULL;
    }

    size_t start = 0;
    for (;;) {
        ssize_t commaPos = val.find(",", start);
@@ -256,9 +261,11 @@ APacketSource::APacketSource(
        sp<ABuffer> codecSpecificData =
            MakeAVCCodecSpecificData(params.c_str());

        if (codecSpecificData != NULL) {
            mFormat->setData(
                    kKeyAVCC, 0,
                    codecSpecificData->data(), codecSpecificData->size());
        }
    } else if (!strncmp(desc.c_str(), "H263-2000/", 10)
            || !strncmp(desc.c_str(), "H263-1998/", 10)) {
        mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_H263);