webrtc_sink: Set channel and samplerate if available when making a media format 07/266207/3
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 9 Nov 2021 06:25:52 +0000 (15:25 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 9 Nov 2021 06:50:21 +0000 (15:50 +0900)
This code blocks is activated when user calls webrtc_set_encoded_audio_frame_cb().

[Version] 0.3.5
[Issue Type] Improvement

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

index abd614de8274ad586dd707926a80e193d0bf662a..a093534ece93e06929dccf25bcbebf1fa7176e52 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.4
+Version:    0.3.5
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index b5f478ba9ec0e115b9eb05461f110930de5b6c08..5b9fdc38772dff2fd5ba540cbc6910ea1c26b137 100644 (file)
@@ -645,11 +645,25 @@ static media_format_h __make_media_format(GstPad *pad)
                        }
                }
        } else if (mimetype & MEDIA_FORMAT_AUDIO) {
+               gint channels = 0;
+               gint rate = 0;
+
                ret = media_format_set_audio_mime(format, mimetype);
                if (ret != MEDIA_FORMAT_ERROR_NONE) {
                        LOG_ERROR("failed to media_format_set_audio_mime()");
                        goto error;
                }
+
+               gst_structure_get_int(structure, "channels", &channels);
+               gst_structure_get_int(structure, "rate", &rate);
+               if (channels > 0 && rate > 0) {
+                       ret |= media_format_set_audio_channel(format, channels);
+                       ret |= media_format_set_audio_samplerate(format, rate);
+                       if (ret != MEDIA_FORMAT_ERROR_NONE) {
+                               LOG_ERROR("failed to media_format_set_audio_channel/samplerate()");
+                               goto error;
+                       }
+               }
        }
 
        gst_caps_unref(caps);