Changeset 3953


Ignore:
Timestamp:
Feb 16, 2012 8:49:33 AM (7 years ago)
Author:
ming
Message:

Re 1446#: Fix division by zero error caused by DShow if video device does not supply AvgTimePerFrame? information (AvgTimePerFrame?=0).

Location:
pjproject/trunk/pjmedia/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/dshow_dev.c

    r3934 r3953  
    770770        video_info->bmiHeader.biHeight = vfd->size.h; 
    771771    } 
    772     if (!use_def_fps && vfd->fps.num != 0) 
     772    if (video_info->AvgTimePerFrame == 0 || 
     773        (!use_def_fps && vfd->fps.num != 0)) 
     774    { 
    773775        video_info->AvgTimePerFrame = (LONGLONG) (10000000 *  
    774776                                                  (double)vfd->fps.denum / 
    775777                                                  vfd->fps.num); 
     778    } 
    776779    video_info->bmiHeader.biSizeImage = DIBSIZE(video_info->bmiHeader); 
    777780    mediatype->lSampleSize = DIBSIZE(video_info->bmiHeader); 
  • pjproject/trunk/pjmedia/src/pjmedia/format.c

    r3819 r3953  
    114114                                        unsigned fps_denum) 
    115115{ 
     116    pj_assert(fps_denum); 
    116117    fmt->id = fmt_id; 
    117118    fmt->type = PJMEDIA_TYPE_VIDEO; 
Note: See TracChangeset for help on using the changeset viewer.