[Asterisk-cvs] asterisk/channels chan_vpb.c,1.86,1.87
bkramer at lists.digium.com
bkramer at lists.digium.com
Thu Jun 9 23:16:19 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv1325
Modified Files:
chan_vpb.c
Log Message:
/ fixes possibility for accessing of struct when null
Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- chan_vpb.c 8 Jun 2005 00:10:09 -0000 1.86
+++ chan_vpb.c 10 Jun 2005 03:18:24 -0000 1.87
@@ -1149,8 +1149,13 @@
}
} else if (e->data == p->ring_timer_id) {
/* We didnt get another ring in time! */
- if (p->owner->_state != AST_STATE_UP) {
- /* Assume caller has hung up */
+ if (p->owner){
+ if (p->owner->_state != AST_STATE_UP) {
+ /* Assume caller has hung up */
+ vpb_timer_stop(p->ring_timer);
+ }
+ } else {
+ /* No owner any more, Assume caller has hung up */
vpb_timer_stop(p->ring_timer);
}
}
@@ -2238,21 +2243,21 @@
/* return ((double)tv.tv_sec*1000)+((double)tv.tv_usec/1000); */
if ((p->read_state == 1)&&(p->play_buf_time<5)){
- gettimeofday(&play_buf_time_start,NULL);
- res = vpb_play_buf_sync(p->handle, (char*)frame->data, frame->datalen);
- if( (res == VPB_OK) && (option_verbose > 5) ) {
- short * data = (short*)frame->data;
- ast_verbose("%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]);
- }
- gettimeofday(&play_buf_time_finish,NULL);
- if (play_buf_time_finish.tv_sec == play_buf_time_start.tv_sec){
- p->play_buf_time=(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
-/* ast_log(LOG_DEBUG, "%s: vpb_write: Timing start(%d) finish(%d)\n", p->dev,play_buf_time_start.tv_usec,play_buf_time_finish.tv_usec); */
- }
- else {
- p->play_buf_time=(int)((play_buf_time_finish.tv_sec - play_buf_time_start.tv_sec)*100)+(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
- }
-/* ast_log(LOG_DEBUG, "%s: vpb_write: Wrote data [%d](%d=>%s) to play_buf in [%d]ms..\n", p->dev,frame->datalen,fmt,ast2vpbformatname(frame->subclass),p->play_buf_time); */
+ gettimeofday(&play_buf_time_start,NULL);
+ res = vpb_play_buf_sync(p->handle, (char*)frame->data, frame->datalen);
+ if( (res == VPB_OK) && (option_verbose > 5) ) {
+ short * data = (short*)frame->data;
+ ast_verbose("%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]);
+ }
+ gettimeofday(&play_buf_time_finish,NULL);
+ if (play_buf_time_finish.tv_sec == play_buf_time_start.tv_sec){
+ p->play_buf_time=(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
+ /* ast_log(LOG_DEBUG, "%s: vpb_write: Timing start(%d) finish(%d)\n", p->dev,play_buf_time_start.tv_usec,play_buf_time_finish.tv_usec); */
+ }
+ else {
+ p->play_buf_time=(int)((play_buf_time_finish.tv_sec - play_buf_time_start.tv_sec)*100)+(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
+ }
+ /* ast_log(LOG_DEBUG, "%s: vpb_write: Wrote data [%d](%d=>%s) to play_buf in [%d]ms..\n", p->dev,frame->datalen,fmt,ast2vpbformatname(frame->subclass),p->play_buf_time); */
}
else {
p->chuck_count++;
More information about the svn-commits
mailing list