Changeset 3975 for pjproject/trunk


Ignore:
Timestamp:
Mar 14, 2012 12:36:42 PM (13 years ago)
Author:
nanang
Message:

Misc (re #1446): Re-enable remote video frame-rate detection in vid_stream.c. Note that currently such remote frame-rate update will not trigger format changed event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c

    r3955 r3975  
    10121012 
    10131013    /* Learn remote frame rate after successful decoding */ 
    1014     if (0 && frame->type == PJMEDIA_FRAME_TYPE_VIDEO && frame->size) 
     1014    if (frame->type == PJMEDIA_FRAME_TYPE_VIDEO && frame->size) 
    10151015    { 
    10161016        /* Only check remote frame rate when timestamp is not wrapping and 
     
    10261026            vfd = pjmedia_format_get_video_format_detail( 
    10271027                                    &channel->port.info.fmt, PJ_TRUE); 
    1028             if ((int)(stream->info.codec_info.clock_rate / ts_diff) != 
    1029                 vfd->fps.num / vfd->fps.denum) 
     1028            if (stream->info.codec_info.clock_rate * vfd->fps.denum != 
     1029                vfd->fps.num * ts_diff) 
    10301030            { 
    10311031                /* Frame rate changed, update decoding port info */ 
    1032                 vfd->fps.num = stream->info.codec_info.clock_rate; 
    1033                 vfd->fps.denum = ts_diff; 
     1032                if (stream->info.codec_info.clock_rate % ts_diff == 0) { 
     1033                    vfd->fps.num = stream->info.codec_info.clock_rate/ts_diff; 
     1034                    vfd->fps.denum = 1; 
     1035                } else { 
     1036                    vfd->fps.num = stream->info.codec_info.clock_rate; 
     1037                    vfd->fps.denum = ts_diff; 
     1038                } 
    10341039 
    10351040                /* Update stream info */ 
    10361041                stream->info.codec_param->dec_fmt.det.vid.fps = vfd->fps; 
    10371042 
    1038                 PJ_LOG(5, (channel->port.info.name.ptr, 
    1039                            "Frame rate changed to %d/%d(~%d)fps", 
     1043                PJ_LOG(6, (channel->port.info.name.ptr, 
     1044                          "Frame rate update: %d/%d(~%.2f)fps", 
    10401045                           vfd->fps.num, vfd->fps.denum, 
    1041                            vfd->fps.num / vfd->fps.denum)); 
     1046                           vfd->fps.num*1.0 / vfd->fps.denum)); 
    10421047 
    10431048                /* Publish PJMEDIA_EVENT_FMT_CHANGED event */ 
    1044                 { 
     1049                if (0) { 
    10451050                    pjmedia_event event; 
    10461051 
Note: See TracChangeset for help on using the changeset viewer.