int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
int _set_video_framerate(webrtc_s *webrtc, unsigned int source_id, int framerate);
int _get_video_framerate(webrtc_s *webrtc, unsigned int source_id, int *framerate);
-int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index);
+int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index, int aec_ref_device_id);
int _set_sound_stream_info(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info);
int _set_media_format(webrtc_s *webrtc, unsigned int source_id, media_format_h format);
bool _check_if_format_is_set_to_packet_sources(webrtc_s *webrtc);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.111
+Version: 0.3.112
Release: 0
Group: Multimedia/API
License: Apache-2.0
return ret;
}
-int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index)
+int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index, int aec_ref_device_id)
{
GstStructure *structure;
- char values[64] = {'\0',};
+ g_autofree gchar *prop = NULL;
+ g_autofree gchar *prop_with_aec = NULL;
+ bool aec = (aec_ref_device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE);
RET_VAL_IF(element == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "element is NULL");
RET_VAL_IF(stream_type == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "stream_type is NULL");
RET_VAL_IF(!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(element)), "stream-properties"),
WEBRTC_ERROR_INVALID_OPERATION, "could not find 'stream-properties'");
- snprintf(values, sizeof(values) - 1, "props,%s=%s, %s=%d", PA_PROP_MEDIA_ROLE, stream_type, PA_PROP_MEDIA_PARENT_ID, stream_index);
- RET_VAL_IF(!(structure = gst_structure_from_string(values, NULL)),
- WEBRTC_ERROR_INVALID_OPERATION, "failed to gst_structure_from_string(), [%s]", values);
+ prop = g_strdup_printf("props,%s=%s, %s=%d", PA_PROP_MEDIA_ROLE, stream_type, PA_PROP_MEDIA_PARENT_ID, stream_index);
+ if (aec) {
+ prop_with_aec = g_strdup_printf("%s, %s=%s, %s=%d",
+ prop, PA_PROP_MEDIA_ECHO_CANCEL_METHOD, "default", PA_PROP_MEDIA_ECHO_CANCEL_REFERENCE_DEVICE, aec_ref_device_id);
+ }
+
+ RET_VAL_IF(!(structure = gst_structure_from_string(aec ? prop_with_aec : prop, NULL)),
+ WEBRTC_ERROR_INVALID_OPERATION, "failed to gst_structure_from_string(), [%s]", aec ? prop_with_aec : prop);
- LOG_INFO("stream-properties[%s]", values);
+ LOG_INFO("stream-properties[%s]", aec ? prop_with_aec : prop);
g_object_set(G_OBJECT(element), "stream-properties", structure, NULL);
gst_structure_free(structure);
if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(audiosink)), "stream-properties")) {
if (sink->sound_stream_info.type) {
- ret = _apply_stream_info(audiosink, sink->sound_stream_info.type, sink->sound_stream_info.index);
+ ret = _apply_stream_info(audiosink, sink->sound_stream_info.type, sink->sound_stream_info.index,
+ SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE);
if (ret != WEBRTC_ERROR_NONE) /* FIXME: unref all the created elements */
return WEBRTC_ERROR_INVALID_OPERATION;
}
bool available = false;
char *stream_type;
int stream_index;
+ int aec_ref_device_id = 0;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source");
sound_manager_get_type_from_stream_information(stream_info, &stream_type);
sound_manager_get_index_from_stream_information(stream_info, &stream_index);
+ sound_manager_get_echo_cancel_reference_device(stream_info, &aec_ref_device_id);
ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_WEBRTC, &available);
if (ret != SOUND_MANAGER_ERROR_NONE) {
return WEBRTC_ERROR_INVALID_PARAMETER;
}
- LOG_INFO("webrtc[%p], source_id[%u], stream_info[%p, type:%s, index:%d]", webrtc, source_id, stream_info, stream_type, stream_index);
+ LOG_INFO("webrtc[%p], source_id[%u], stream_info[%p, type:%s, index:%d, aec_ref_device_id:%d]",
+ webrtc, source_id, stream_info, stream_type, stream_index, aec_ref_device_id);
- return _apply_stream_info(element, stream_type, stream_index);
+ return _apply_stream_info(element, stream_type, stream_index, aec_ref_device_id);
}
int _set_media_format(webrtc_s *webrtc, unsigned int source_id, media_format_h format)
if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(audiosink)), "stream-properties")) {
if (source->sound_stream_info.type) {
- ret = _apply_stream_info(audiosink, source->sound_stream_info.type, source->sound_stream_info.index);
+ ret = _apply_stream_info(audiosink, source->sound_stream_info.type, source->sound_stream_info.index,
+ SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE);
if (ret != WEBRTC_ERROR_NONE)
goto exit;
}