summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Yuan <shengquan.yuan@intel.com>2013-05-09 18:15:49 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-06-25 13:53:58 +0800
commitad03345ba32034ed02d364821cdfaf4725312a18 (patch)
treefed52634b16791af4b4aae683b046bac58660890
parenta5891ab029619697fcb6e642df0af996a2c658df (diff)
h264encode: fix thread lockup issue
Change-Id: I3e0f23b5301d8405297b4b88b27e9edccdab6063 Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
-rw-r--r--test/encode/h264encode.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/encode/h264encode.c b/test/encode/h264encode.c
index ae5d766..e34f6b4 100644
--- a/test/encode/h264encode.c
+++ b/test/encode/h264encode.c
@@ -1594,7 +1594,7 @@ static int upload_source_YUV_once_for_all()
row_shift++;
if (row_shift==(2*box_width)) row_shift= 0;
}
- printf("Completed surface loading\n");
+ printf("Complete surface loading\n");
return 0;
}
@@ -1774,7 +1774,7 @@ static int save_codeddata(unsigned long long display_order, unsigned long long e
}
-static struct storage_task_t * storage_task_dequque(void)
+static struct storage_task_t * storage_task_dequeue(void)
{
struct storage_task_t *header;
@@ -1841,6 +1841,7 @@ static void storage_task(unsigned long long display_order, unsigned long long en
pthread_mutex_lock(&encode_mutex);
srcsurface_status[display_order % SURFACE_NUM] = SRC_SURFACE_IN_ENCODING;
+ pthread_cond_signal(&encode_cond);
pthread_mutex_unlock(&encode_mutex);
}
@@ -1850,7 +1851,7 @@ static void * storage_task_thread(void *t)
while (1) {
struct storage_task_t *current;
- current = storage_task_dequque();
+ current = storage_task_dequeue();
if (current == NULL) {
pthread_mutex_lock(&encode_mutex);
pthread_cond_wait(&encode_cond, &encode_mutex);
@@ -1904,8 +1905,14 @@ static int encode_frames(void)
current_frame_num = 0;
current_IDR_display = current_frame_display;
}
+
/* check if the source frame is ready */
- while (srcsurface_status[current_slot] != SRC_SURFACE_IN_ENCODING);
+ while (srcsurface_status[current_slot] != SRC_SURFACE_IN_ENCODING) {
+ pthread_mutex_lock(&encode_mutex);
+ pthread_cond_wait(&encode_cond, &encode_mutex);
+ pthread_mutex_unlock(&encode_mutex);
+ }
+
tmp = GetTickCount();
va_status = vaBeginPicture(va_dpy, context_id, src_surface[current_slot]);
CHECK_VASTATUS(va_status,"vaBeginPicture");