- Timestamp:
- Jun 22, 2018 8:22:01 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/android_dev.c
r5544 r5810 566 566 jsize cnt, j; 567 567 pj_bool_t has_i420 = PJ_FALSE; 568 int k; 568 569 569 570 cnt = (*jni_env)->GetArrayLength(jni_env, jiarray); 570 571 fmts = (*jni_env)->GetIntArrayElements(jni_env, jiarray, 0); 571 572 for (j = 0; j < cnt; j++) { 572 int k;573 573 pjmedia_format_id fmt = and_fmt_to_pj((pj_uint32_t)fmts[j]); 574 575 /* Check for any duplicate */576 for (k = 0; k < vdi->fmt_cnt; k++) {577 if (fmt == 0 || fmt == vdi->fmt[k].id) {578 fmt = 0;579 break;580 }581 }582 574 583 575 /* Make sure we recognize this format */ … … 589 581 else if (fmt == PJMEDIA_FORMAT_YV12) adi->has_yv12 = PJ_TRUE; 590 582 else if (fmt == PJMEDIA_FORMAT_NV21) adi->has_nv21 = PJ_TRUE; 591 583 } 584 (*jni_env)->ReleaseIntArrayElements(jni_env, jiarray, fmts, 585 JNI_ABORT); 586 (*jni_env)->DeleteLocalRef(jni_env, jtmp); 587 588 /* Always put I420/IYUV and in the first place, for better 589 * compatibility. 590 */ 591 adi->forced_i420 = !has_i420; 592 for (k = 0; k < adi->sup_size_cnt && 593 vdi->fmt_cnt < max_fmt_cnt-1; k++) 594 { 595 /* Landscape video */ 596 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 597 PJMEDIA_FORMAT_I420, 598 adi->sup_size[k].w, 599 adi->sup_size[k].h, 600 DEFAULT_FPS, 1); 601 /* Portrait video */ 602 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 603 PJMEDIA_FORMAT_I420, 604 adi->sup_size[k].h, 605 adi->sup_size[k].w, 606 DEFAULT_FPS, 1); 607 } 608 609 /* YV12 */ 610 if (adi->has_yv12) { 592 611 for (k = 0; k < adi->sup_size_cnt && 593 612 vdi->fmt_cnt < max_fmt_cnt-1; k++) … … 595 614 /* Landscape video */ 596 615 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 597 fmt,616 PJMEDIA_FORMAT_YV12, 598 617 adi->sup_size[k].w, 599 618 adi->sup_size[k].h, … … 601 620 /* Portrait video */ 602 621 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 603 fmt,622 PJMEDIA_FORMAT_YV12, 604 623 adi->sup_size[k].h, 605 624 adi->sup_size[k].w, … … 607 626 } 608 627 } 609 (*jni_env)->ReleaseIntArrayElements(jni_env, jiarray, fmts, 610 JNI_ABORT); 611 (*jni_env)->DeleteLocalRef(jni_env, jtmp); 612 613 /* Pretend to support I420/IYUV, only if we support YV12/NV21 */ 614 if (!has_i420 && (adi->has_yv12 || adi->has_nv21) && 615 vdi->fmt_cnt < PJ_ARRAY_SIZE(vdi->fmt)) 616 { 617 int k; 618 adi->forced_i420 = PJ_TRUE; 628 629 /* NV21 */ 630 if (adi->has_nv21) { 619 631 for (k = 0; k < adi->sup_size_cnt && 620 632 vdi->fmt_cnt < max_fmt_cnt-1; k++) 621 633 { 634 /* Landscape video */ 622 635 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 623 PJMEDIA_FORMAT_ I420,636 PJMEDIA_FORMAT_NV21, 624 637 adi->sup_size[k].w, 625 638 adi->sup_size[k].h, 626 639 DEFAULT_FPS, 1); 640 /* Portrait video */ 627 641 pjmedia_format_init_video(&vdi->fmt[vdi->fmt_cnt++], 628 PJMEDIA_FORMAT_ I420,642 PJMEDIA_FORMAT_NV21, 629 643 adi->sup_size[k].h, 630 644 adi->sup_size[k].w, … … 632 646 } 633 647 } 648 634 649 } else { 635 650 goto on_skip_dev;
Note: See TracChangeset
for help on using the changeset viewer.