Ignore:
Timestamp:
Oct 21, 2011 1:36:02 AM (13 years ago)
Author:
nanang
Message:

Re #1390: Fixed ffmpeg codecs to update size & fps in AVCodecContext after applying SDP fmtp to codec param.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c

    r3824 r3833  
    349349 
    350350    if (ff->param.dir & PJMEDIA_DIR_ENCODING) { 
     351        pjmedia_video_format_detail *vfd; 
    351352        AVCodecContext *ctx = ff->enc_ctx; 
    352353        const char *profile = NULL; 
     354 
     355        vfd = pjmedia_format_get_video_format_detail(&ff->param.enc_fmt,  
     356                                                     PJ_TRUE); 
     357 
     358        /* Override generic params after applying SDP fmtp */ 
     359        ctx->width = vfd->size.w; 
     360        ctx->height = vfd->size.h; 
     361        ctx->time_base.num = vfd->fps.denum; 
     362        ctx->time_base.den = vfd->fps.num; 
    353363 
    354364        /* Apply profile. */ 
     
    474484    if (!ff->param.ignore_fmtp) { 
    475485        status = pjmedia_vid_codec_h263_apply_fmtp(&ff->param); 
     486    } 
     487 
     488    /* Override generic params after applying SDP fmtp */ 
     489    if (ff->param.dir & PJMEDIA_DIR_ENCODING) { 
     490        pjmedia_video_format_detail *vfd; 
     491        AVCodecContext *ctx = ff->enc_ctx; 
     492 
     493        vfd = pjmedia_format_get_video_format_detail(&ff->param.enc_fmt,  
     494                                                     PJ_TRUE); 
     495 
     496        /* Override generic params after applying SDP fmtp */ 
     497        ctx->width = vfd->size.w; 
     498        ctx->height = vfd->size.h; 
     499        ctx->time_base.num = vfd->fps.denum; 
     500        ctx->time_base.den = vfd->fps.num; 
    476501    } 
    477502 
     
    10851110    } 
    10861111 
    1087     /* Init codec override generic params or apply specific params before 
    1088      * the codec opened. 
     1112    /* Override generic params or apply specific params before opening 
     1113     * the codec. 
    10891114     */ 
    10901115    if (ff->desc->preopen) { 
Note: See TracChangeset for help on using the changeset viewer.