Fix error of 64bit compile 39/261939/1 accepted/tizen/unified/20210729.092200 submit/tizen/20210729.090018
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 29 Jul 2021 07:38:58 +0000 (16:38 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 29 Jul 2021 07:55:52 +0000 (16:55 +0900)
Various fixes due to the gsize.
 : print format is corrected.
 : webrtc_get_data() is revised to have unsigned long* type for
  it's the second out-param.

Missing '%' command is added to have valid usr/lib[64] dir in
the spec file.

Fix build error in case of using define for tv profile.

[Version] 0.2.61
[Issue Type] Build and API

Change-Id: Ide1b0241b1b8f20e26a422d2d9a1ab4be69f87f7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
CMakeLists.txt
include/webrtc.h
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_data_channel.c
src/webrtc_options.c
src/webrtc_sink.c
src/webrtc_source.c
test/webrtc_test.c

index 951af7f7c870bd718187f83e2a884bb0e57946c8..3c6aa2e7af881d767ce6fb4f1f607d41fefd0fff 100644 (file)
@@ -6,7 +6,6 @@ PROJECT(${fw_name})
 
 SET(CMAKE_INSTALL_PREFIX /usr)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
 
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
@@ -71,7 +70,6 @@ INSTALL(
 SET(PC_NAME ${fw_name})
 SET(PC_REQUIRED ${pc_dependents})
 SET(PC_LDFLAGS -l${fw_name})
-SET(PC_CFLAGS -I\${includedir}/media)
 
 CONFIGURE_FILE(
     ${fw_name}.pc.in
index 7ffaf96d80cdce6c6797637d24b7ce296c7d2890..ca025c1bd68c1f2ac4bf6958f61faae36dbb6d76 100644 (file)
@@ -1952,7 +1952,7 @@ int webrtc_data_channel_get_label(webrtc_data_channel_h channel, char **label);
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @see webrtc_data_channel_message_cb()
  */
-int webrtc_get_data(webrtc_bytes_data_h bytes, const char **data, unsigned int *size);
+int webrtc_get_data(webrtc_bytes_data_h bytes, const char **data, unsigned long *size);
 
 /**
  * @}
index 30a725e231891234c42ba202313f385d0de770e0..e61eda93d38333a9407ce6ef15ad538c2071ed0e 100644 (file)
@@ -493,7 +493,7 @@ typedef struct _webrtc_data_channel_s {
 
 typedef struct _webrtc_bytes_data_s {
        void *data;
-       unsigned int size;
+       unsigned long size;
 } webrtc_bytes_data_s;
 
 typedef struct _element_info_s {
index beac6b8c9e46bfc31ed8a33cda356e16e4837316..1af033e82295af5b0c96a11c2417cf42a56e735f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.60
+Version:    0.2.61
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -40,7 +40,7 @@ A WebRTC library in Tizen Native API.
 
 %package devel
 Summary:    Multimedia WebRTC Library in Tizen Native API (Development)
-Group:      TO_BE/FILLED_IN
+Group:      Multimedia/Development
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
@@ -51,10 +51,11 @@ WebRTC Library in Tizen Native API (DEV).
 cp %{SOURCE1001} .
 
 %build
-MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 export CFLAGS+=" -DSYSCONFDIR=\\\"%{_hal_sysconfdir}\\\""
 export CXXFLAGS+=" -DSYSCONFDIR=\\\"%{_hal_sysconfdir}\\\""
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
 %if "%{tizen_profile_name}" == "tv"
 -DTIZEN_PROFILE_TV=on
 %else
@@ -65,8 +66,8 @@ make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
-mkdir -p %{buildroot}/usr/bin
-cp test/webrtc_test %{buildroot}/usr/bin
+mkdir -p %{buildroot}%{_bindir}
+cp test/webrtc_test %{buildroot}%{_bindir}
 
 %make_install
 
@@ -78,13 +79,13 @@ cp test/webrtc_test %{buildroot}/usr/bin
 
 %files
 %manifest %{name}.manifest
-%{_libdir}/libcapi-media-webrtc.so.*
+%{_libdir}/lib%{name}.so.*
+%{_bindir}/webrtc_test
 %license LICENSE.APLv2
-/usr/bin/*
 
 %files devel
 %{_includedir}/media/*.h
 %{_libdir}/pkgconfig/*.pc
-%{_libdir}/libcapi-media-webrtc.so
+%{_libdir}/lib%{name}.so
 
 
index c6d77356c4f7932fb78244cc3585d97574c45098..63fbee1a7ec804710f0091e84493a39edf7b38ae 100644 (file)
@@ -1718,7 +1718,7 @@ int webrtc_data_channel_get_label(webrtc_data_channel_h channel, char **label)
        return WEBRTC_ERROR_NONE;
 }
 
-int webrtc_get_data(webrtc_bytes_data_h bytes, const char **data, unsigned int *size)
+int webrtc_get_data(webrtc_bytes_data_h bytes, const char **data, unsigned long *size)
 {
        webrtc_bytes_data_s *_bytes = (webrtc_bytes_data_s*)bytes;
 
@@ -1729,7 +1729,7 @@ int webrtc_get_data(webrtc_bytes_data_h bytes, const char **data, unsigned int *
        *data = (const char*)_bytes->data;
        *size = _bytes->size;
 
-       LOG_INFO("data[%p] size[%u]", *data, *size);
+       LOG_INFO("data[%p] size[%lu]", *data, *size);
 
        return WEBRTC_ERROR_NONE;
 }
index 9674aacb18dff8f8c5abe0923e3130dd6bb27e32..81a85f7c91b27d0ce0482fa06a4eabb03153d1a2 100644 (file)
@@ -53,12 +53,14 @@ static void __data_channel_on_message_data_cb(GObject *data_channel, GBytes *byt
 
        RET_IF(channel == NULL, "channel is NULL");
 
-       LOG_DEBUG("channel[%p, %s] bytes[%p, size:%u] user_data[%p]",
+       LOG_DEBUG("channel[%p, %s] bytes[%p, size:%"G_GSIZE_FORMAT"] user_data[%p]",
                channel, GST_OBJECT_NAME(data_channel), bytes, g_bytes_get_size(bytes), user_data);
 
        if (channel->message_cb.callback) {
                webrtc_bytes_data_s data = { 0, };
-               data.data = (void*)g_bytes_get_data(bytes, &data.size);
+               gsize size;
+               data.data = (void*)g_bytes_get_data(bytes, &size);
+               data.size = (unsigned long)size;
 
                LOG_DEBUG(">>> callback[%p] user_data[%p]", channel->message_cb.callback, channel->message_cb.user_data);
                ((webrtc_data_channel_message_cb)(channel->message_cb.callback))((webrtc_data_channel_h)channel, WEBRTC_DATA_CHANNEL_TYPE_BYTES, &data, channel->message_cb.user_data);
index 108b0584084292a524f4a042961795f3c05e59c9..fc37189c304a1e6907c4185f352bcc2531b23e34 100644 (file)
@@ -103,7 +103,7 @@ static void __set_key_value(GstStructure *structure, const char *key, void *valu
                gst_structure_set(structure, key, type, (gchar*)value, NULL);
                break;
        default:
-               LOG_ERROR("not supported GType(%d)", type);
+               LOG_ERROR("not supported GType(%d)", (int)type);
        }
 }
 
index 171a7ecb509460cf495c61a7966ed208347824ef..1f927b09bc6fe23097bd6186498936796f8a3e22 100644 (file)
@@ -655,7 +655,7 @@ static int __set_codec_data_if_exist(media_packet_h packet, GstPad *pad)
                        LOG_ERROR("failed to media_packet_set_codec_data()");
                        ret = WEBRTC_ERROR_INVALID_OPERATION;
                }
-               LOG_DEBUG("codec_data[%p, size:%u] is set to the media packet[%p]", buff_info.data, buff_info.size, packet);
+               LOG_DEBUG("codec_data[%p, size:%"G_GSIZE_FORMAT"] is set to the media packet[%p]", buff_info.data, buff_info.size, packet);
                gst_buffer_unmap(codec_data, &buff_info);
        }
 
index 429837f07581852315133f0350d5932d95f232ce..49869d10a956378daf1db5d56593431b42e3537f 100644 (file)
@@ -2786,7 +2786,7 @@ static int __fill_gst_buffer_mapped_data_from_packet(GstBuffer *buffer, media_pa
 
                buff_info.size = size;
 
-               LOG_DEBUG("buffer[%p], buff_info[data:%p, size:%u]", buffer, buff_info.data, buff_info.size);
+               LOG_DEBUG("buffer[%p], buff_info[data:%p, size:%"G_GSIZE_FORMAT"]", buffer, buff_info.data, buff_info.size);
 
                gst_buffer_unmap(buffer, &buff_info);
        }
@@ -2894,7 +2894,8 @@ static GstBuffer* __make_buffer_from_zerocopy_video_packet(webrtc_gst_slot_s *so
        GST_BUFFER_DURATION(buffer) = duration;
        gst_buffer_append_memory(buffer, mem);
 
-       LOG_DEBUG("buffer[%p, pts:%llu, dts:%llu, duration:%llu, tizen memory:%p]", buffer, pts, dts, duration, mem);
+       LOG_DEBUG("buffer[%p, pts:%"G_GUINT64_FORMAT", dts:%"G_GUINT64_FORMAT", duration:%"G_GUINT64_FORMAT", tizen memory:%p]",
+               buffer, pts, dts, duration, mem);
 
        return buffer;
 }
@@ -3005,7 +3006,8 @@ int _push_media_packet(webrtc_s *webrtc, unsigned int source_id, media_packet_h
        }
        GST_BUFFER_DURATION(buffer) = duration;
 
-       LOG_DEBUG("new gst buffer[%p, pts:%llu, dts:%llu, duration:%llu]", buffer, pts, dts, duration);
+       LOG_DEBUG("new gst buffer[%p, pts:%"G_GUINT64_FORMAT", dts:%"G_GUINT64_FORMAT", duration:%"G_GUINT64_FORMAT"]",
+               buffer, pts, dts, duration);
 
        g_signal_emit_by_name(G_OBJECT(appsrc), "push-buffer", buffer, &gst_ret, NULL);
        if (gst_ret != GST_FLOW_OK) {
@@ -3352,7 +3354,6 @@ static int __build_loopback_videosink(webrtc_gst_slot_s *source, GstElement *lin
        const char *videosink_factory_name;
        GstElement *videosink;
        GstElement *videoconvert;
-       int ret = WEBRTC_ERROR_NONE;
 
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
        RET_VAL_IF(link_with == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "link_with is NULL");
@@ -3385,7 +3386,8 @@ static int __build_loopback_videosink(webrtc_gst_slot_s *source, GstElement *lin
 
 #ifndef TIZEN_TV
        if (source->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY && webrtc->ini.resource_acquisition.video_overlay) {
-               if ((ret = _acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY))) {
+               int ret;
+               if ((ret = _acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY)) != WEBRTC_ERROR_NONE) {
                        SAFE_GST_OBJECT_UNREF(videosink);
                        SAFE_GST_OBJECT_UNREF(videoconvert);
                        return ret;
index 344f4eba0bd070ac8a7361fa10c436acd8645406..f93cc9d6654cdbc9416334e2caa4ec8ffe5c0b9a 100644 (file)
@@ -1173,7 +1173,7 @@ static void __data_channel_message_cb(webrtc_data_channel_h channel, webrtc_data
                                        conn->receive_buffer = NULL;
                                }
                                if (conn->expected_size > MAX_EXPECTED_SIZE)
-                                       g_print("expected_size[%llu], too big to alloc memory, skip it\n", conn->expected_size);
+                                       g_print("expected_size[%"G_GUINT64_FORMAT"], too big to alloc memory, skip it\n", conn->expected_size);
                                else
                                        conn->receive_buffer = (char *)calloc(conn->expected_size, sizeof(char));
                        }
@@ -1185,14 +1185,14 @@ static void __data_channel_message_cb(webrtc_data_channel_h channel, webrtc_data
        } else if (type == WEBRTC_DATA_CHANNEL_TYPE_BYTES) {
                webrtc_bytes_data_h *data = message;
                const char *data_p;
-               unsigned int size;
+               unsigned long size;
                int i = 0;
 
                webrtc_get_data(data, &data_p, &size);
-               g_print("bytes message[%p, size:%u]\n", data_p, size);
+               g_print("bytes message[%p, size:%lu]\n", data_p, size);
 
                if (conn->expected_size > 0 && conn->expected_name) {
-                       g_print("downloading [%s], size[%llu / %llu]\n", conn->expected_name, conn->sum_size, conn->expected_size);
+                       g_print("downloading [%s], size[%"G_GUINT64_FORMAT" / %"G_GUINT64_FORMAT"]\n", conn->expected_name, conn->sum_size, conn->expected_size);
 
                        if (conn->receive_buffer == NULL) {
                                g_print("receive_buffer is null, skip copying it\n");
@@ -2042,7 +2042,7 @@ static media_packet_h __make_media_packet(media_packet_source_s *packet_source,
                ret |= media_packet_set_dts(packet, last_dts);
                ret |= media_packet_set_duration(packet, GST_BUFFER_DURATION(buffer));
 
-               g_print("buffer[%p], size[%u], pts[%llu], dts[%llu], duration[%llu]\n",
+               g_print("buffer[%p], size[%"G_GSIZE_FORMAT"], pts[%"G_GUINT64_FORMAT"], dts[%"G_GUINT64_FORMAT"], duration[%"G_GUINT64_FORMAT"]\n",
                        buffer, gst_buffer_get_size(buffer), last_pts, last_dts, GST_BUFFER_DURATION(buffer));
 
                /* FIXME: We put the gstbuffer to extra field of media packet. It does not guarantee the validity of the gstbuffer
@@ -2069,7 +2069,8 @@ static media_packet_h __make_media_packet(media_packet_source_s *packet_source,
        last_pts = pts = base_pts + GST_BUFFER_PTS(buffer);
        last_dts = dts = base_dts + GST_BUFFER_DTS(buffer);
        duration = GST_BUFFER_DURATION(buffer);
-       g_print("buffer[%p], size[%u], pts[%llu], dts[%llu], duration[%llu]\n", buffer, size, last_pts, last_dts, duration);
+       g_print("buffer[%p], size[%"G_GSIZE_FORMAT"], pts[%"G_GUINT64_FORMAT"], dts[%"G_GUINT64_FORMAT"], duration[%"G_GUINT64_FORMAT"]\n",
+               buffer, size, last_pts, last_dts, duration);
 
        ret = media_packet_set_pts(packet, last_pts);
        if (ret != MEDIA_PACKET_ERROR_NONE) {