summaryrefslogtreecommitdiffstats
path: root/tinyDAV
diff options
context:
space:
mode:
authorMamadou DIOP <bossiel@yahoo.fr>2016-01-22 07:07:28 +0100
committerMamadou DIOP <bossiel@yahoo.fr>2016-01-22 07:07:28 +0100
commit94b2219209038e05dd26395f6fb700be4d1062c0 (patch)
treec2e6635732a86864c907cccd71d89c6ded987a74 /tinyDAV
parente5d2be814027989ec7f8d6eecf365ffd9149b21e (diff)
downloaddoubango-94b2219209038e05dd26395f6fb700be4d1062c0.zip
doubango-94b2219209038e05dd26395f6fb700be4d1062c0.tar.gz
Fix concurrent access issue on "video_jb->decode_last_timestamp"
Diffstat (limited to 'tinyDAV')
-rwxr-xr-xtinyDAV/src/video/jb/tdav_video_jb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tinyDAV/src/video/jb/tdav_video_jb.c b/tinyDAV/src/video/jb/tdav_video_jb.c
index 4540fcf..ec9b53b 100755
--- a/tinyDAV/src/video/jb/tdav_video_jb.c
+++ b/tinyDAV/src/video/jb/tdav_video_jb.c
@@ -426,7 +426,6 @@ static void* TSK_STDCALL _tdav_video_jb_decode_thread_func(void *arg)
int32_t missing_seq_num_start = 0, prev_missing_seq_num_start = 0;
int32_t missing_seq_num_count = 0, prev_lasted_missing_seq_num_count = 0;
const tdav_video_frame_t* frame;
- tsk_list_item_t* item;
uint64_t next_decode_duration = 0, now, _now, latency = 0;
//uint64_t x_decode_duration = (1000 / jb->fps); // expected
//uint64_t x_decode_time = tsk_time_now();//expected
@@ -457,7 +456,7 @@ static void* TSK_STDCALL _tdav_video_jb_decode_thread_func(void *arg)
// the second condition (jb->frames_count > 0 && latency >= jb->latency_max) is required to make sure we'll process the pending pkts even if the remote party stops sending frames. GE issue: device stops sending frames when it enters in "frame freeze" mode which means #"latency_min" frames won't be displayed.
if (jb->frames_count >= (int64_t)jb->latency_min || (jb->frames_count > 0 && latency >= jb->latency_max)) {
- item = tsk_null;
+ tsk_list_item_t *item = tsk_null;
postpone = tsk_false;
latency = 0;
@@ -489,14 +488,16 @@ static void* TSK_STDCALL _tdav_video_jb_decode_thread_func(void *arg)
// postpone is equal to "tsk_false" which means the pending frame will be displayed in all cases
}
if (!postpone) {
- item = tsk_list_pop_first_item(jb->frames);
- --jb->frames_count;
+ if ((item = tsk_list_pop_first_item(jb->frames))) { // always true (jb->frames_count > 0)
+ --jb->frames_count;
+ // Update the latest decoded timestamp here while we have the lock on the frames
+ jb->decode_last_timestamp = ((const tdav_video_frame_t*)item->data)->timestamp;
+ }
}
tsk_list_unlock(jb->frames);
tsk_safeobj_unlock(jb);
if (item) {
- jb->decode_last_timestamp = ((const tdav_video_frame_t*)item->data)->timestamp;
if(jb->callback){
trtp_rtp_packet_t* pkt;
const tsk_list_item_t* _item = item; // save memory address as "tsk_list_foreach() will change it for each loop"
OpenPOWER on IntegriCloud