From: Sangchul Lee Date: Fri, 17 Sep 2021 07:20:23 +0000 (+0900) Subject: webrtc_test: Prepare for test case with esplusplayer to render data when using encode... X-Git-Tag: submit/tizen/20210929.042039~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50d5ee4d8f13aa5f2aa239a5b22f5a4295d2e3f3;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_test: Prepare for test case with esplusplayer to render data when using encoded frame callback It'll be the default case to test encoded frame callback. For now, it is excluded when TV profile build. [Version] 0.2.107 [Issue Type] Improvement Change-Id: I85bae50e99bd937daf2e53aa901a1ecd90a6de98 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 81c38768..6d2a8258 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.2.106 +Version: 0.2.107 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -33,6 +33,7 @@ BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(bundle) %if "%{tizen_profile_name}" != "tv" BuildRequires: pkgconfig(mm-resource-manager) +BuildRequires: pkgconfig(esplusplayer) %endif %description diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35a27839..4b8fda29 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,11 @@ INCLUDE_DIRECTORIES(../include) link_directories(${CMAKE_SOURCE_DIR}/../) INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_test} REQUIRED glib-2.0 appcore-efl elementary libsoup-2.4) +IF(NOT TIZEN_PROFILE_TV) + pkg_check_modules(${fw_test} REQUIRED glib-2.0 appcore-efl elementary libsoup-2.4 esplusplayer) +ELSE() + pkg_check_modules(${fw_test} REQUIRED glib-2.0 appcore-efl elementary libsoup-2.4) +ENDIF() FOREACH(flag ${${fw_test}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 36d6df2b..98958a20 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -18,6 +18,9 @@ #include #include #include +#ifndef TIZEN_TV +#include +#endif #include #include #include @@ -210,8 +213,15 @@ typedef struct _connection_s { sound_stream_info_h stream_info; webrtc_display_type_e display_type; Evas_Object *eo; +#ifndef TIZEN_TV + esplusplayer_handle espp; +#endif } render; +#ifndef TIZEN_TV + bool encoded_video_frame_cb_is_set; + bool encoded_audio_frame_cb_is_set; +#endif #ifdef __DEBUG_VALIDATE_ENCODED_FRAME_CB__ GstElement *render_pipeline; GstElement *appsrc; @@ -481,6 +491,18 @@ static void _webrtc_destroy(int index) sound_manager_destroy_stream_information(g_conns[index].render.stream_info); g_conns[index].render.stream_info = NULL; } +#ifndef TIZEN_TV + if (g_conns[index].encoded_audio_frame_cb_is_set) + g_conns[index].encoded_audio_frame_cb_is_set = false; + + if (g_conns[index].encoded_video_frame_cb_is_set) + g_conns[index].encoded_video_frame_cb_is_set = false; + + if (g_conns[index].render.espp) { + g_conns[index].render.espp = NULL; + g_print("espp close & destroy\n"); + } +#endif } static void _webrtc_start(int index) @@ -493,6 +515,19 @@ static void _webrtc_start(int index) RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); g_print("webrtc_start() success\n"); +#ifndef TIZEN_TV + if (g_conns[index].encoded_audio_frame_cb_is_set || + g_conns[index].encoded_video_frame_cb_is_set) { + if (!g_conns[index].render.espp) + g_print("espp create & open\n"); + } + + if (g_conns[index].encoded_audio_frame_cb_is_set) + g_print("espp set audio stream info\n"); + + if (g_conns[index].encoded_video_frame_cb_is_set) + g_print("espp set video stream info\n"); +#endif } static void _webrtc_stop(int index) @@ -521,6 +556,15 @@ static void _webrtc_stop(int index) g_print("appsrc render pipeline is released\n"); } #endif +#ifndef TIZEN_TV + if (g_conns[index].encoded_audio_frame_cb_is_set || + g_conns[index].encoded_video_frame_cb_is_set) { + if (g_conns[index].render.espp) { + g_conns[index].render.espp = NULL; + g_print("espp destroy\n"); + } + } +#endif } static void _webrtc_get_state(int index) @@ -1860,6 +1904,22 @@ static void __track_added_cb(webrtc_h webrtc, webrtc_media_type_e type, unsigned g_print("__track_added_cb() is invoked, webrtc[%p], type[%d], id[%u], conn[%p]\n", webrtc, type, id, conn); +#ifndef TIZEN_TV + if (conn->encoded_audio_frame_cb_is_set && type == WEBRTC_MEDIA_TYPE_AUDIO) { + if (conn->render.espp) { + /* espp: state check & prepare async */ + g_print("espp prepare async\n"); + } + return; + } + if (conn->encoded_video_frame_cb_is_set && type == WEBRTC_MEDIA_TYPE_VIDEO) { + if (conn->render.espp) { + /* espp: state check & prepare async */ + g_print("espp prepare async\n"); + } + return; + } +#endif if (type == WEBRTC_MEDIA_TYPE_VIDEO) { #ifndef __DEBUG_VALIDATE_ENCODED_FRAME_CB__ if (conn->render.display_type == WEBRTC_DISPLAY_TYPE_OVERLAY) { @@ -1929,7 +1989,24 @@ static void __encoded_frame_cb(webrtc_h webrtc, webrtc_media_type_e type, unsign g_print("webrtc[%p] type[%u] track_id[%u] packet[%p, data_ptr:%p] user_data[%p]\n", webrtc, type, track_id, packet, data_ptr, user_data); +#ifndef TIZEN_TV + if (type == WEBRTC_MEDIA_TYPE_AUDIO && conn->encoded_audio_frame_cb_is_set) { + if (!conn->render.espp) { + g_printerr("render.espp is NULL\n"); + media_packet_destroy(packet); + return; + } + /* TODO: submit data to espp */ + } else if (type == WEBRTC_MEDIA_TYPE_VIDEO && conn->encoded_video_frame_cb_is_set) { + if (!conn->render.espp) { + g_printerr("render.espp is NULL\n"); + media_packet_destroy(packet); + return; + } + /* TODO: submit data to espp */ + } +#endif #ifdef __DEBUG_VALIDATE_ENCODED_FRAME_CB__ { GstFlowReturn gst_ret = GST_FLOW_OK; @@ -1964,6 +2041,15 @@ static void _webrtc_set_encoded_audio_frame_cb(int index) RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); g_print("webrtc_set_encoded_audio_frame_cb() success\n"); +#ifndef TIZEN_TV + if (!g_conns[index].encoded_audio_frame_cb_is_set) { + g_conns[index].encoded_audio_frame_cb_is_set = true; + if (!g_conns[index].render.espp) + g_print("espp create & open\n"); + + g_print("espp set audio stream info\n"); + } +#endif } static void _webrtc_unset_encoded_audio_frame_cb(int index) @@ -1974,6 +2060,12 @@ static void _webrtc_unset_encoded_audio_frame_cb(int index) RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); g_print("webrtc_unset_encoded_audio_frame_cb() success\n"); +#ifndef TIZEN_TV + if (g_conns[index].encoded_audio_frame_cb_is_set) { + g_conns[index].encoded_audio_frame_cb_is_set = false; + g_print("espp close & destroy\n"); + } +#endif } static void _webrtc_set_encoded_video_frame_cb(int index) @@ -1984,6 +2076,15 @@ static void _webrtc_set_encoded_video_frame_cb(int index) RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); g_print("webrtc_set_encoded_video_frame_cb() success\n"); +#ifndef TIZEN_TV + if (!g_conns[index].encoded_video_frame_cb_is_set) { + g_conns[index].encoded_video_frame_cb_is_set = true; + if (!g_conns[index].render.espp) { + g_print("espp create & open\n"); + } + g_print("espp set video stream info\n"); + } +#endif } static void _webrtc_unset_encoded_video_frame_cb(int index) @@ -1991,10 +2092,15 @@ static void _webrtc_unset_encoded_video_frame_cb(int index) int ret = WEBRTC_ERROR_NONE; ret = webrtc_unset_encoded_video_frame_cb(g_conns[index].webrtc); - if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_unset_encoded_video_frame_cb()\n"); - else - g_print("webrtc_unset_encoded_video_frame_cb() success\n"); + RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); + + g_print("webrtc_unset_encoded_video_frame_cb() success\n"); +#ifndef TIZEN_TV + if (g_conns[index].encoded_video_frame_cb_is_set) { + g_conns[index].encoded_video_frame_cb_is_set = false; + g_print("espp close & destroy\n"); + } +#endif } static void __media_packet_source_buffer_state_changed_cb(unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data)