summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2018-04-26 04:42:49 (GMT)
committerhj kim <backto.kim@samsung.com>2018-05-11 00:40:46 (GMT)
commit7c69a752fe648c40dc02c40abbde669eeaa07109 (patch)
treeb1cd69254862bf9da416eff87f5a7fd4f17f953e /server
parent24da53c234808e06b5a5c29bcb5e63bffa93d30a (diff)
downloadlibmedia-thumbnail-7c69a752fe648c40dc02c40abbde669eeaa07109.zip
libmedia-thumbnail-7c69a752fe648c40dc02c40abbde669eeaa07109.tar.gz
libmedia-thumbnail-7c69a752fe648c40dc02c40abbde669eeaa07109.tar.bz2
1. Rollback to split transmission 2. Change block size 512 to 10K Change-Id: I1786a26c08546ccaade8089970ad8edeb2cf2a60 Signed-off-by: Minje Ahn <minje.ahn@samsung.com> (cherry picked from commit bd703adacacd8e39c94140883cfe535ce05d3dee)
Diffstat (limited to 'server')
-rwxr-xr-xserver/thumb-server-internal.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 5a279d4..32fd5a3 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -37,6 +37,7 @@
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
#define THUMB_DEFAULT_WIDTH 320
#define THUMB_DEFAULT_HEIGHT 240
+#define THUMB_BLOCK_SIZE 10240
#define THUMB_COMM_SOCK_PATH tzplatform_mkpath(TZ_SYS_RUN, "media-server/media_ipc_thumbcomm.socket")
#define THUMB_EMPTY_STR ""
@@ -135,24 +136,23 @@ gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpoi
res_msg.dst_path[0] = '\0';
int buf_size = 0;
- int remain_size = 0;
- int head_size = sizeof(res_msg) - sizeof(unsigned char *);
+ int sending_block = 0;
+ int block_size = sizeof(res_msg) - sizeof(unsigned char *);
unsigned char *buf = NULL;
_media_thumb_set_buffer(&res_msg, &buf, &buf_size);
- remain_size = buf_size - head_size;
- if (send(client_sock, buf, head_size, 0) < 0) {
- thumb_stderror("send failed");
- } else {
- if (remain_size > 0) {
- if (send(client_sock, buf + head_size, remain_size, 0) < 0) {
- thumb_stderror("send failed");
- } else {
- thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
- }
- } else {
- thumb_dbg_slog("Sent thumbnail(%s) from %s", res_msg.dst_path, res_msg.org_path);
+ while (buf_size > 0) {
+ if (buf_size < THUMB_BLOCK_SIZE)
+ block_size = buf_size;
+
+ if (send(client_sock, buf+sending_block, block_size, 0) < 0) {
+ thumb_stderror("send failed");
}
+
+ sending_block += block_size;
+ buf_size -= block_size;
+ if (block_size < THUMB_BLOCK_SIZE)
+ block_size = THUMB_BLOCK_SIZE;
}
SAFE_FREE(buf);