From 8e1de9604bc597b4f28d5bfcff7a10efdca63bcd Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 27 May 2021 15:43:48 +0900 Subject: [PATCH] webrtc: Add error condition in webrtc_set_display() The track added callback will be invoked even if the encoded video frame callback has been set. Within this callback, this patch let webrtc_set_display() return the invalid operation error by looking the encoded video frame callback is set, not by _is_owner_of_track_build_context() the previous one. Doxygen is also updated. [Version] 0.1.173 [Issue Type] Improvement Change-Id: If889e51602de878cf369aaadbda1d99ca63b4fe9 Signed-off-by: Sangchul Lee --- include/webrtc.h | 3 ++- packaging/capi-media-webrtc.spec | 2 +- src/webrtc.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/webrtc.h b/include/webrtc.h index c7e1b5a4..ab456aec 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -820,7 +820,8 @@ int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, we /** * @brief Set a 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. + * @remarks Call this function within webrtc_track_added_cb(), otherwise #WEBRTC_ERROR_INVALID_OPERATION will be returned.\n + * If webrtc_set_encoded_video_frame_cb() has been called, it will return #WEBRTC_ERROR_INVALID_OPERATION. * @param[in] webrtc WebRTC handle * @param[in] track_id The track id * @param[in] type The display type diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index d06becfc..e673c034 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.1.172 +Version: 0.1.173 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index b06e7d70..42a4945f 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -519,7 +519,8 @@ int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_ty 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->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "track added callback was not set"); + RET_VAL_WITH_UNLOCK_IF(_webrtc->encoded_video_frame_cb.callback, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "encoded video frame callback was set"); RET_VAL_WITH_UNLOCK_IF(!_is_owner_of_track_build_context(_webrtc, track_id), WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "this function should be called within the track added callback"); -- 2.34.1