[Redbutton-devel] SF.net SVN: redbutton: [68] redbutton-browser/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-05-17 14:12:47
|
Revision: 68 Author: skilvington Date: 2006-05-17 07:12:37 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=68&view=rev Log Message: ----------- keep track of the number of frames on the videoq Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/MHEGStreamPlayer.h Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-16 15:41:12 UTC (rev 67) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-17 14:12:37 UTC (rev 68) @@ -70,6 +70,7 @@ p->video = NULL; pthread_mutex_init(&p->videoq_lock, NULL); + p->videoq_len = 0; p->videoq = NULL; pthread_mutex_init(&p->current_frame_lock, NULL); @@ -168,6 +169,7 @@ pthread_join(p->video_tid, NULL); /* clean up */ + p->videoq_len = 0; LIST_FREE(&p->videoq, VideoFrame, free_VideoFrameListItem); if(p->ts != NULL) @@ -258,6 +260,7 @@ pts = pkt.dts / video_time_base; video_frame = new_VideoFrameListItem(pts, video_codec_ctx->pix_fmt, video_codec_ctx->width, video_codec_ctx->height, frame); pthread_mutex_lock(&p->videoq_lock); + p->videoq_len ++; LIST_APPEND(&p->videoq, video_frame); pthread_mutex_unlock(&p->videoq_lock); //printf("decode: got video frame: pts=%f (real pts=%f) width=%d height=%d\n", pts, pkt.pts / video_time_base, video_codec_ctx->width, video_codec_ctx->height); @@ -491,6 +494,10 @@ } /* we can delete the frame from the queue now */ pthread_mutex_lock(&p->videoq_lock); + /* assert */ + if(p->videoq_len == 0) + fatal("video_thread: videoq_len is 0"); + p->videoq_len --; LIST_FREE_HEAD(&p->videoq, VideoFrame, free_VideoFrameListItem); pthread_mutex_unlock(&p->videoq_lock); } Modified: redbutton-browser/trunk/MHEGStreamPlayer.h =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-16 15:41:12 UTC (rev 67) +++ redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-17 14:12:37 UTC (rev 68) @@ -50,6 +50,7 @@ pthread_t decode_tid; /* thread decoding the MPEG stream into frames */ pthread_t video_tid; /* thread displaying frames on the screen */ pthread_mutex_t videoq_lock; /* list of decoded video frames */ + unsigned int videoq_len; /* number of frames on the videoq */ LIST_OF(VideoFrame) *videoq; /* head of list is next to be displayed */ pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ XImage *current_frame; /* frame we are currently displaying */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |