Changeset 5913
- Timestamp:
- Nov 22, 2018 3:33:42 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
r5894 r5913 1254 1254 { 1255 1255 pj_uint32_t ts_diff; 1256 pjmedia_ video_format_detail *vfd;1256 pjmedia_ratio new_fps; 1257 1257 1258 1258 ts_diff = frm_ts - stream->last_dec_ts; 1259 vfd = pjmedia_format_get_video_format_detail( 1260 &channel->port.info.fmt, PJ_TRUE); 1261 if (stream->info.codec_info.clock_rate * vfd->fps.denum != 1262 vfd->fps.num * ts_diff) 1259 1260 /* Calculate new FPS based on RTP timestamp diff */ 1261 if (stream->info.codec_info.clock_rate % ts_diff == 0) { 1262 new_fps.num = stream->info.codec_info.clock_rate/ts_diff; 1263 new_fps.denum = 1; 1264 } else { 1265 new_fps.num = stream->info.codec_info.clock_rate; 1266 new_fps.denum = ts_diff; 1267 } 1268 1269 /* Only apply the new FPS when it is >0, <=100, and increasing */ 1270 if (new_fps.num/new_fps.denum <= 100 && 1271 new_fps.num/new_fps.denum > 0 && 1272 new_fps.num*1.0/new_fps.denum > 1273 stream->dec_max_fps.num*1.0/stream->dec_max_fps.denum) 1263 1274 { 1264 /* Frame rate changed, update decoding port info */ 1265 if (stream->info.codec_info.clock_rate % ts_diff == 0) { 1266 vfd->fps.num = stream->info.codec_info.clock_rate/ts_diff; 1267 vfd->fps.denum = 1; 1268 } else { 1269 vfd->fps.num = stream->info.codec_info.clock_rate; 1270 vfd->fps.denum = ts_diff; 1271 } 1272 1273 /* Update stream info */ 1274 stream->info.codec_param->dec_fmt.det.vid.fps = vfd->fps; 1275 1276 /* Update the decoding delay as FPS updated */ 1275 pjmedia_video_format_detail *vfd; 1276 vfd = pjmedia_format_get_video_format_detail( 1277 &channel->port.info.fmt, PJ_TRUE); 1278 1279 /* Update FPS in channel & stream info */ 1280 vfd->fps = new_fps; 1281 stream->info.codec_param->dec_fmt.det.vid.fps = new_fps; 1282 1283 /* Update the decoding delay */ 1277 1284 { 1278 1285 pjmedia_jb_state jb_state; … … 1290 1297 } 1291 1298 1292 /* Publish PJMEDIA_EVENT_FMT_CHANGED event if frame rate 1293 * increased and not exceeding 100fps. 1294 */ 1295 if (vfd->fps.num/vfd->fps.denum <= 100 && 1296 vfd->fps.num * stream->dec_max_fps.denum > 1297 stream->dec_max_fps.num * vfd->fps.denum) 1299 /* Publish PJMEDIA_EVENT_FMT_CHANGED event */ 1298 1300 { 1299 1301 pjmedia_event *event = &stream->fmt_event; … … 2116 2118 if ((dir & PJMEDIA_DIR_ENCODING) && stream->enc) { 2117 2119 stream->enc->paused = 0; 2120 stream->force_keyframe = PJ_TRUE; 2118 2121 PJ_LOG(4,(stream->enc->port.info.name.ptr, "Encoder stream resumed")); 2119 2122 } … … 2121 2124 if ((dir & PJMEDIA_DIR_DECODING) && stream->dec) { 2122 2125 stream->dec->paused = 0; 2126 stream->last_dec_seq = 0; 2123 2127 PJ_LOG(4,(stream->dec->port.info.name.ptr, "Decoder stream resumed")); 2124 2128 }
Note: See TracChangeset
for help on using the changeset viewer.