Changeset 4010
- Timestamp:
- Apr 3, 2012 7:47:55 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
r4003 r4010 1027 1027 vfd->fps.num * ts_diff) 1028 1028 { 1029 pjmedia_ratio old_fps; 1030 1031 old_fps = vfd->fps; 1032 1029 1033 /* Frame rate changed, update decoding port info */ 1030 1034 if (stream->info.codec_info.clock_rate % ts_diff == 0) { … … 1039 1043 stream->info.codec_param->dec_fmt.det.vid.fps = vfd->fps; 1040 1044 1041 PJ_LOG(6, (channel->port.info.name.ptr, 1042 "Frame rate update: %d/%d(~%.2f)fps", 1043 vfd->fps.num, vfd->fps.denum, 1044 vfd->fps.num*1.0 / vfd->fps.denum)); 1045 1046 /* Publish PJMEDIA_EVENT_FMT_CHANGED event */ 1047 if (0) { 1048 pjmedia_event event; 1049 1050 dump_port_info(stream->dec, "changed"); 1051 1052 pjmedia_event_init(&event, PJMEDIA_EVENT_FMT_CHANGED, 1053 &frame->timestamp, stream); 1054 event.data.fmt_changed.dir = PJMEDIA_DIR_DECODING; 1055 pj_memcpy(&event.data.fmt_changed.new_fmt, 1056 &stream->info.codec_param->dec_fmt, 1057 sizeof(pjmedia_format)); 1058 pjmedia_event_publish(NULL, stream, &event, 0); 1045 /* Publish PJMEDIA_EVENT_FMT_CHANGED event if frame rate 1046 * increased and not exceeding 100fps. 1047 */ 1048 if (vfd->fps.num/vfd->fps.denum < 100 && 1049 vfd->fps.num*old_fps.denum > old_fps.num*vfd->fps.denum) 1050 { 1051 pjmedia_event *event = &stream->fmt_event; 1052 1053 /* Use the buffered format changed event: 1054 * - just update the framerate if there is pending event, 1055 * - otherwise, init the whole event. 1056 */ 1057 if (stream->fmt_event.type != PJMEDIA_EVENT_NONE) { 1058 event->data.fmt_changed.new_fmt.det.vid.fps = vfd->fps; 1059 } else { 1060 pjmedia_event_init(event, PJMEDIA_EVENT_FMT_CHANGED, 1061 &frame->timestamp, stream); 1062 event->data.fmt_changed.dir = PJMEDIA_DIR_DECODING; 1063 pj_memcpy(&event->data.fmt_changed.new_fmt, 1064 &stream->info.codec_param->dec_fmt, 1065 sizeof(pjmedia_format)); 1066 } 1059 1067 } 1060 1068 } … … 1089 1097 */ 1090 1098 if (stream->fmt_event.type != PJMEDIA_EVENT_NONE) { 1091 /* Update param from codec */ 1092 pjmedia_vid_codec_get_param(stream->codec, stream->info.codec_param); 1093 1094 /* Update decoding channel port info */ 1095 pjmedia_format_copy(&stream->dec->port.info.fmt, 1096 &stream->info.codec_param->dec_fmt); 1097 1098 dump_port_info(stream->fmt_event.data.fmt_changed.dir==PJMEDIA_DIR_DECODING ? 1099 pjmedia_event_fmt_changed_data *fmt_chg_data; 1100 1101 fmt_chg_data = &stream->fmt_event.data.fmt_changed; 1102 1103 /* Update stream info and decoding channel port info */ 1104 if (fmt_chg_data->dir == PJMEDIA_DIR_DECODING) { 1105 pjmedia_format_copy(&stream->info.codec_param->dec_fmt, 1106 &fmt_chg_data->new_fmt); 1107 pjmedia_format_copy(&stream->dec->port.info.fmt, 1108 &fmt_chg_data->new_fmt); 1109 1110 /* Override the framerate to be 1.5x higher in the event 1111 * for the renderer. 1112 */ 1113 fmt_chg_data->new_fmt.det.vid.fps.num *= 3; 1114 fmt_chg_data->new_fmt.det.vid.fps.num /= 2; 1115 } else { 1116 pjmedia_format_copy(&stream->info.codec_param->enc_fmt, 1117 &fmt_chg_data->new_fmt); 1118 pjmedia_format_copy(&stream->enc->port.info.fmt, 1119 &fmt_chg_data->new_fmt); 1120 } 1121 1122 dump_port_info(fmt_chg_data->dir==PJMEDIA_DIR_DECODING ? 1099 1123 stream->dec : stream->enc, 1100 "changed");1124 "changed"); 1101 1125 1102 1126 pjmedia_event_publish(NULL, port, &stream->fmt_event, 0);
Note: See TracChangeset
for help on using the changeset viewer.