Changeset 6149
- Timestamp:
- Feb 3, 2020 6:26:55 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_codec_util.c
r6110 r6149 816 816 817 817 if (fmtp.max_fr > 0) { 818 vfd->fps.num = fmtp.max_fr; 819 vfd->fps.denum = 1; 818 if ((float)vfd->fps.num/vfd->fps.denum > (float)fmtp.max_fr) { 819 vfd->fps.num = fmtp.max_fr; 820 vfd->fps.denum = 1; 821 } 820 822 } 821 823 … … 823 825 unsigned max_res = ((int)pj_isqrt(fmtp.max_fs * 8)) * 16; 824 826 825 /* Do we need to maintain the aspect ratio or scale down 826 * to some predetermined resolution instead (for example, 827 * if the requested resolution is 640x480 and max_res is 828 * 600, should we scale down to 480xx360)? 829 */ 830 if (vfd->size.w > max_res) 831 vfd->size.w = max_res; 832 if (vfd->size.h > max_res) 833 vfd->size.h = max_res; 827 if (vfd->size.w > max_res || vfd->size.h > max_res) { 828 /* Here we maintain the aspect ratio. Or should we scale down 829 * to some predetermined resolution instead (for example, 830 * if the requested resolution is 640x480 and max_res is 831 * 600, should we scale down to 480x360)? 832 */ 833 unsigned larger = (vfd->size.w > vfd->size.h)? 834 vfd->size.w: vfd->size.h; 835 float scale = (float)max_res/larger; 836 837 vfd->size.w = (int)(scale * vfd->size.w); 838 vfd->size.h = (int)(scale * vfd->size.h); 839 } 834 840 } 835 841 }
Note: See TracChangeset
for help on using the changeset viewer.