diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2012-03-14 12:36:42 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2012-03-14 12:36:42 +0000 |
commit | 29bfd6c47e8f72441c36e04ca8d12f3cc90bd61b (patch) | |
tree | a099f6574ef69664b22b47f6609507a8a211c8ce /pjmedia | |
parent | 667407ad70dbf6d331c10236e1dfeba01f1e5c01 (diff) |
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.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3975 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/vid_stream.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/pjmedia/src/pjmedia/vid_stream.c b/pjmedia/src/pjmedia/vid_stream.c index 4b56770b..0e3dfb44 100644 --- a/pjmedia/src/pjmedia/vid_stream.c +++ b/pjmedia/src/pjmedia/vid_stream.c @@ -1011,7 +1011,7 @@ static pj_status_t decode_frame(pjmedia_vid_stream *stream, } /* Learn remote frame rate after successful decoding */ - if (0 && frame->type == PJMEDIA_FRAME_TYPE_VIDEO && frame->size) + if (frame->type == PJMEDIA_FRAME_TYPE_VIDEO && frame->size) { /* Only check remote frame rate when timestamp is not wrapping and * sequence is increased by 1. @@ -1025,23 +1025,28 @@ static pj_status_t decode_frame(pjmedia_vid_stream *stream, ts_diff = last_ts - stream->last_dec_ts; vfd = pjmedia_format_get_video_format_detail( &channel->port.info.fmt, PJ_TRUE); - if ((int)(stream->info.codec_info.clock_rate / ts_diff) != - vfd->fps.num / vfd->fps.denum) + if (stream->info.codec_info.clock_rate * vfd->fps.denum != + vfd->fps.num * ts_diff) { /* Frame rate changed, update decoding port info */ - vfd->fps.num = stream->info.codec_info.clock_rate; - vfd->fps.denum = ts_diff; + if (stream->info.codec_info.clock_rate % ts_diff == 0) { + vfd->fps.num = stream->info.codec_info.clock_rate/ts_diff; + vfd->fps.denum = 1; + } else { + vfd->fps.num = stream->info.codec_info.clock_rate; + vfd->fps.denum = ts_diff; + } /* Update stream info */ stream->info.codec_param->dec_fmt.det.vid.fps = vfd->fps; - PJ_LOG(5, (channel->port.info.name.ptr, - "Frame rate changed to %d/%d(~%d)fps", + PJ_LOG(6, (channel->port.info.name.ptr, + "Frame rate update: %d/%d(~%.2f)fps", vfd->fps.num, vfd->fps.denum, - vfd->fps.num / vfd->fps.denum)); + vfd->fps.num*1.0 / vfd->fps.denum)); /* Publish PJMEDIA_EVENT_FMT_CHANGED event */ - { + if (0) { pjmedia_event event; dump_port_info(stream->dec, "changed"); |