webrtc_transceiver: Fix unwanted payload type number order 19/304119/1 accepted/tizen/7.0/unified/20240111.114552
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 10 Jan 2024 08:13:25 +0000 (17:13 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 10 Jan 2024 09:19:30 +0000 (18:19 +0900)
This patch fixes the issue where there is another media source added
before the null source, the payload type number gets reversed because
the payload type number of the null source type was obtained when calling
webrtc_media_source_set_transceiver_codec() whereas other source type
get it when calling webrtc_start().

[Version] 0.3.298
[Issue Type] Bug fix

Change-Id: Ib438dc280c843ddf8652d114a4ced23319f73b71
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_transceiver.c

index 253a69a02cc3ec4410ba006b8bac2a9ec3ee8b09..52cd7b626de062b717640e9bd69a882adf8393f5 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.297
+Version:    0.3.298
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 35f904a194c887e8074670a354f2803840a1ecd2..6ee3fbb3ca15cfe7569bb9acda6adeef308099f3 100644 (file)
@@ -416,6 +416,12 @@ int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type,
                g_signal_emit_by_name(source->webrtc->gst.webrtcbin, "add-transceiver",
                        GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY, caps, &trans, NULL);
                gst_object_unref(trans);
+
+               if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE && !source->av[av_idx].pt_set_by_api)
+                       _return_payload_type(source->webrtc, source->av[av_idx].pt);
+
+               if ((_set_payload_type(source->webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE)
+                       return WEBRTC_ERROR_INVALID_OPERATION;
        } else {
                g_object_set(G_OBJECT(source->av[av_idx].transceiver), "codec-preferences", caps, NULL);
        }
@@ -649,14 +655,6 @@ int _set_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi
 
        source->av[av_idx].codec = payload_info->encoding_name;
 
-       if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL) {
-               if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE)
-                       _return_payload_type(webrtc, source->av[av_idx].pt);
-
-               if ((ret = _set_payload_type(webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE)
-                       return ret;
-       }
-
        /* FIXME: to utilize 'codec-preferences' of trans object, we need to re-create and re-link elements again */
        LOG_INFO("webrtc[%p] source_id[%u] media_type[%d] codec[%s]", webrtc, source_id, media_type, payload_info->encoding_name);