It can be utilized to set the ecore wayland window.
[Version] 0.1.69
[Issue Type] API
Change-Id: I036185364c75ab5c6e25c32855e7cabbbdc9bca9
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_MEDIA_WEBRTC_INTERNAL_H__
+#define __TIZEN_MEDIA_WEBRTC_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+* @file webrtc_internal.h
+* @brief This file contains the WebRTC internal API.
+*/
+
+/**
+* @addtogroup CAPI_MEDIA_WEBRTC_MODULE
+* @{
+*/
+
+/**
+ * @internal
+ * @brief Set an ecore wayland display to the media track.
+ * @since_tizen 6.5
+ * @remarks Call this function within webrtc_track_added_cb(), otherwise #WEBRTC_ERROR_INVALID_OPERATION will be returned.
+ * @param[in] webrtc WebRTC handle
+ * @param[in] track_id The track id
+ * @param[in] ecore_wl_window The ecore wayland window handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
+ * @pre webrtc_track_added_cb() must be set by calling webrtc_set_track_added_cb().
+ * @see webrtc_set_track_added_cb()
+ * @see webrtc_unset_track_added_cb()
+ */
+int webrtc_set_ecore_wl_display(webrtc_h webrtc, unsigned int track_id, void *ecore_wl_window);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIA_WEBRTC_INTERNAL_H__ */
g_free(dot_name); \
} while (0)
+#define WEBRTC_DISPLAY_TYPE_ECORE_WL 2
+
typedef enum {
MEDIA_TYPE_AUDIO = 0x01,
MEDIA_TYPE_VIDEO = 0x02,
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.1.68
+Version: 0.1.69
Release: 0
Group: Multimedia/API
License: Apache-2.0
{
int ret = MM_ERROR_NONE;
webrtc_display_s *display = (webrtc_display_s*)user_data;
+ mm_display_type_e type = MM_DISPLAY_TYPE_OVERLAY;
RET_VAL_IF(display == NULL, G_SOURCE_REMOVE, "display is NULL");
+ RET_VAL_IF(display->type != WEBRTC_DISPLAY_TYPE_OVERLAY && display->type != WEBRTC_DISPLAY_TYPE_ECORE_WL, G_SOURCE_REMOVE,
+ "invalid display type(%d)", display->type);
g_mutex_lock(&display->mutex);
- ret = mm_display_interface_set_display(display->mm_display, MM_DISPLAY_TYPE_OVERLAY, display->object, &display->overlay_surface_id);
- if (ret != MM_ERROR_NONE) {
- LOG_ERROR("failed to mm_display_interface_set_display(), ret[0x%x]", ret);
- g_mutex_unlock(&display->mutex);
- return G_SOURCE_REMOVE;
- }
+ if (display->type == WEBRTC_DISPLAY_TYPE_ECORE_WL)
+ type = MM_DISPLAY_TYPE_OVERLAY_EXT;
- LOG_INFO("overlay_surface_id[%d]", display->overlay_surface_id);
+ ret = mm_display_interface_set_display(display->mm_display, type, display->object, &display->overlay_surface_id);
+ if (ret != MM_ERROR_NONE)
+ LOG_ERROR("failed to mm_display_interface_set_display(), ret[0x%x]", ret);
+ else
+ LOG_INFO("overlay_surface_id[%d]", display->overlay_surface_id);
g_mutex_unlock(&display->mutex);
int _apply_display(webrtc_display_s *display)
{
- RET_VAL_IF(display == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "sink is NULL");
+ RET_VAL_IF(display == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "display is NULL");
switch (display->type) {
case WEBRTC_DISPLAY_TYPE_OVERLAY:
g_idle_add(__set_evas_display_idle_cb, display);
break;
+ case WEBRTC_DISPLAY_TYPE_ECORE_WL:
+ LOG_DEBUG("it's ECORE_WL type");
+
+ g_idle_add(__set_overlay_display_idle_cb, display);
+ break;
+
default:
LOG_ERROR_IF_REACHED("type(%d)", display->type);
return WEBRTC_ERROR_INVALID_OPERATION;
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "webrtc.h"
+#include "webrtc_private.h"
+
+int webrtc_set_ecore_wl_display(webrtc_h webrtc, unsigned int track_id, void *ecore_wl_window)
+{
+ int ret = WEBRTC_ERROR_NONE;
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(track_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "track id is 0");
+ RET_VAL_IF(ecore_wl_window == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "ecore_wl_window is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ RET_VAL_WITH_UNLOCK_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "callback was not set");
+ RET_VAL_WITH_UNLOCK_IF(!_webrtc->inside_track_added_cb, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "this function should be called within the track added callback");
+
+ ret = _set_display_to_sink(webrtc, track_id, WEBRTC_DISPLAY_TYPE_ECORE_WL, ecore_wl_window);
+ if (ret == WEBRTC_ERROR_NONE)
+ LOG_INFO("track_id[%u] type[%d] display[%p]", track_id, WEBRTC_DISPLAY_TYPE_ECORE_WL, ecore_wl_window);
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return ret;
+}
}
if (display_is_set) {
- if (sink->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY) {
+ if (sink->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY ||
+ sink->display->type == WEBRTC_DISPLAY_TYPE_ECORE_WL) {
gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(videosink), sink->display->overlay_surface_id);
} else if (sink->display->type == WEBRTC_DISPLAY_TYPE_EVAS) {