Changeset 5259
- Timestamp:
- Mar 14, 2016 6:40:45 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_common.c
r4848 r5259 271 271 { 272 272 char capnames[120]; 273 char formats[ 120];273 char formats[200]; 274 274 const char *dirname; 275 275 unsigned i; 276 int st_len; 276 277 277 278 if (vdi->dir == PJMEDIA_DIR_CAPTURE_RENDER) { … … 285 286 286 287 capnames[0] = '\0'; 288 st_len = 0; 287 289 for (i=0; i<sizeof(int)*8 && (1 << i) < PJMEDIA_VID_DEV_CAP_MAX; ++i) { 288 290 if (vdi->caps & (1 << i)) { 289 291 const char *capname = pjmedia_vid_dev_cap_name(1 << i, NULL); 290 292 if (capname) { 293 int tmp_len = strlen(capname); 294 if ((int)sizeof(capnames) - st_len <= tmp_len) 295 break; 296 297 st_len += (tmp_len + 2); 291 298 if (*capnames) 292 299 strcat(capnames, ", "); 293 strncat(capnames, capname, 294 sizeof(capnames)-strlen(capnames)-1); 300 strcat(capnames, capname); 295 301 } 296 302 } … … 298 304 299 305 formats[0] = '\0'; 306 st_len = 0; 300 307 for (i=0; i<vdi->fmt_cnt; ++i) { 301 308 const pjmedia_video_format_info *vfi = 302 309 pjmedia_get_video_format_info(NULL, vdi->fmt[i].id); 303 310 if (vfi) { 311 int tmp_len = strlen(vfi->name); 312 if ((int)sizeof(formats) - st_len <= tmp_len) { 313 st_len = -1; 314 break; 315 } 316 317 st_len += (tmp_len + 2); 304 318 if (*formats) 305 319 strcat(formats, ", "); 306 str ncat(formats, vfi->name, sizeof(formats)-strlen(formats)-1);320 strcat(formats, vfi->name); 307 321 } 308 322 } … … 311 325 dirname, title)); 312 326 PJ_LOG(3,(THIS_FILE, " Supported capabilities: %s", capnames)); 313 PJ_LOG(3,(THIS_FILE, " Supported formats: %s", formats)); 327 PJ_LOG(3,(THIS_FILE, " Supported formats: %s%s", formats, 328 (st_len<0? " ..." : ""))); 314 329 } 315 330
Note: See TracChangeset
for help on using the changeset viewer.