summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-04-30 02:34:40 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-04-30 02:34:40 +0000
commit26184eee4b5427c7d0c61ed1d2db57fb124c6d67 (patch)
tree294ad6756328c5eded575a355e3f35846f2ca3a6
parentaa64fb66073ef9bd15dea205b212bebf9525c987 (diff)
Fix #1501: Added max incoming framerate state in video stream to check for increasing framerate (before triggering PJMEDIA_EVENT_FMT_CHANGED event).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4115 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia/vid_stream.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/pjmedia/src/pjmedia/vid_stream.c b/pjmedia/src/pjmedia/vid_stream.c
index a1dc4e00..b4bc3d40 100644
--- a/pjmedia/src/pjmedia/vid_stream.c
+++ b/pjmedia/src/pjmedia/vid_stream.c
@@ -125,6 +125,7 @@ struct pjmedia_vid_stream
/**< Outgoing RTCP packet size. */
unsigned dec_max_size; /**< Size of decoded/raw picture*/
+ pjmedia_ratio dec_max_fps; /**< Max fps of decoding dir. */
pjmedia_frame dec_frame; /**< Current decoded frame. */
pjmedia_event fmt_event; /**< Buffered fmt_changed event
to avoid deadlock */
@@ -1080,10 +1081,6 @@ static pj_status_t decode_frame(pjmedia_vid_stream *stream,
if (stream->info.codec_info.clock_rate * vfd->fps.denum !=
vfd->fps.num * ts_diff)
{
- pjmedia_ratio old_fps;
-
- old_fps = vfd->fps;
-
/* Frame rate changed, update decoding port info */
if (stream->info.codec_info.clock_rate % ts_diff == 0) {
vfd->fps.num = stream->info.codec_info.clock_rate/ts_diff;
@@ -1099,11 +1096,15 @@ static pj_status_t decode_frame(pjmedia_vid_stream *stream,
/* Publish PJMEDIA_EVENT_FMT_CHANGED event if frame rate
* increased and not exceeding 100fps.
*/
- if (vfd->fps.num/vfd->fps.denum < 100 &&
- vfd->fps.num*old_fps.denum > old_fps.num*vfd->fps.denum)
+ if (vfd->fps.num/vfd->fps.denum <= 100 &&
+ vfd->fps.num * stream->dec_max_fps.denum >
+ stream->dec_max_fps.num * vfd->fps.denum)
{
pjmedia_event *event = &stream->fmt_event;
+ /* Update max fps of decoding dir */
+ stream->dec_max_fps = vfd->fps;
+
/* Use the buffered format changed event:
* - just update the framerate if there is pending event,
* - otherwise, init the whole event.
@@ -1495,6 +1496,7 @@ PJ_DEF(pj_status_t) pjmedia_vid_stream_create(
* will be continuously calculated based on the incoming RTP timestamps.
*/
vfd_dec->fps.num = vfd_dec->fps.num * 3 / 2;
+ stream->dec_max_fps = vfd_dec->fps;
/* Create decoder channel */
status = create_channel( pool, stream, PJMEDIA_DIR_DECODING,