webrtc_transceiver: Fix unwanted payload type number order 13/304113/3
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:13:55 +0000 (18:13 +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.4.32
[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 40a9658b4bb2899dd3e2e1a59c1a67123e9bd0fd..2b53668e63bbbfdcaca89d6a565a984d473f4469 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.4.31
+Version:    0.4.32
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index afaf10c7bccb825912f824b2bf5e915dc0f974da..6224c6fd63e00ce4b2241f3bb1349ff6bf6b476f 100644 (file)
@@ -426,6 +426,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);
        }
@@ -659,14 +665,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);