@@ -157,6 +157,13 @@ int t31_channel_create(char index, short width, short height, char framerate, ch
157157{
158158 int ret ;
159159
160+ if (width > _t31_snr_dim .width || height > _t31_snr_dim .height ) {
161+ HAL_WARNING ("t31_hal" , "Channel %d: requested %dx%d too large, using sensor %dx%d\n" ,
162+ index , width , height , _t31_snr_dim .width , _t31_snr_dim .height );
163+ width = _t31_snr_dim .width ;
164+ height = _t31_snr_dim .height ;
165+ }
166+
160167 {
161168 t31_fs_chn channel = {
162169 .dest = { .width = _t31_snr_dim .width , .height = _t31_snr_dim .height }, .pixFmt = T31_PIXFMT_NV12 ,
@@ -400,6 +407,10 @@ int t31_video_create(char index, hal_vidconfig *config)
400407 }
401408
402409 memset (& channel , 0 , sizeof (channel ));
410+ if (config -> width > _t31_snr_dim .width || config -> height > _t31_snr_dim .height ) {
411+ config -> width = _t31_snr_dim .width ;
412+ config -> height = _t31_snr_dim .height ;
413+ }
403414 t31_venc .fnSetDefaults (& channel , profile , ratemode , config -> width , config -> height ,
404415 config -> framerate , 1 , config -> gop , config -> gop / config -> framerate , -1 , 0 );
405416
0 commit comments