[Redbutton-devel] SF.net SVN: redbutton: [113] redbutton-browser/trunk/MHEGStreamPlayer.c
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-06-14 13:20:52
|
Revision: 113 Author: skilvington Date: 2006-06-14 06:20:45 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=113&view=rev Log Message: ----------- avoid potential NULL ptr dereference Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-06-14 12:36:16 UTC (rev 112) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-06-14 13:20:45 UTC (rev 113) @@ -427,6 +427,7 @@ /* wake up the audio thread */ if(p->have_audio) set_avsync_base(p, 0.0, 0); + verbose("MHEGStreamPlayer: video thread stopped before any output"); return NULL; } @@ -608,7 +609,10 @@ { /* do we need to bomb out early */ if(p->stop) + { + verbose("MHEGStreamPlayer: audio thread stopped before any output"); return NULL; + } /* what PTS are we looking for */ now_time = av_gettime(); now_pts = base_pts + ((now_time - base_time) / 1000000.0); @@ -637,6 +641,13 @@ /* wait until we have some audio frames buffered up */ do { + /* do we need to bomb out early */ + if(p->stop) + { + verbose("MHEGStreamPlayer: audio thread stopped before any output"); + return NULL; + } + /* see how many frames we have buffered so far */ pthread_mutex_lock(&p->audioq_lock); if(p->audioq != NULL) buffered = p->audioq->prev->item.pts - p->audioq->item.pts; @@ -648,7 +659,7 @@ if(buffered < INIT_AUDIO_BUFFER_WAIT) pthread_yield(); } - while(!p->stop && buffered < INIT_AUDIO_BUFFER_WAIT); + while(buffered < INIT_AUDIO_BUFFER_WAIT); /* the time that we played the first frame */ base_time = av_gettime(); pthread_mutex_lock(&p->audioq_lock); @@ -656,10 +667,6 @@ pthread_mutex_unlock(&p->audioq_lock); } - /* do we need to bomb out early */ - if(p->stop) - return NULL; - /* even if this fails, we still need to consume the audioq */ (void) MHEGAudioOutput_init(&ao); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |