Changeset 3432 for pjproject


Ignore:
Timestamp:
Mar 1, 2011 5:40:17 PM (13 years ago)
Author:
nanang
Message:

Re #1182:

  • Fixed ffmpeg codec: decoding buffer size check (should not use assertion), reset output bit_info before decoding, removed unused code of auto resize when decoder output size changed.
  • Fixed bug in sdl_factory_default_param() of sdl_dev.c in device direction check.
  • Fixed compile errors sample app vid_streamutil.c of bad local variable definiton.
  • Updated sample app vid_streamutil.c default renderer size to 640 x 480.
Location:
pjproject/branches/projects/2.0-dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c

    r3425 r3432  
    12731273    PJ_ASSERT_RETURN(ff->dec_ctx, PJ_EINVALIDOP); 
    12741274 
     1275    /* Reset output frame bit info */ 
     1276    output->bit_info = 0; 
     1277 
    12751278    /* Validate output buffer size */ 
    1276     //PJ_ASSERT_RETURN(ff->dec_vafp.framebytes <= output_buf_len, PJ_ETOOSMALL); 
     1279    if (ff->dec_vafp.framebytes > output_buf_len) 
     1280        return PJ_ETOOSMALL; 
    12771281 
    12781282    /* Init frame to receive the decoded data, the ffmpeg codec context will 
     
    13261330            ff->dec_ctx->coded_height != (int)vafp->size.h) 
    13271331        { 
    1328 #if 0        
    1329             // it should not be the codec responsibility to do resizing 
    1330             pj_uint8_t *data[PJMEDIA_MAX_VIDEO_PLANES] = {0}; 
    1331             unsigned i; 
    1332             int h; 
    1333  
    1334             if (!ff->sws_ctx) { 
    1335                 pj_assert(sws_isSupportedInput(ff->dec_ctx->pix_fmt) > 0); 
    1336                 pj_assert(sws_isSupportedOutput(ff->expected_dec_fmt) > 0); 
    1337                 ff->sws_ctx = sws_getContext(ff->dec_ctx->coded_width, 
    1338                                              ff->dec_ctx->coded_height, 
    1339                                              ff->dec_ctx->pix_fmt, 
    1340                                              vafp->size.w, vafp->size.h, 
    1341                                              ff->expected_dec_fmt, 
    1342                                              SWS_BILINEAR | SWS_PRINT_INFO, 
    1343                                              NULL, NULL, NULL); 
    1344                 if (ff->sws_ctx == NULL) { 
    1345                     return PJ_EUNKNOWN; 
    1346                 } 
    1347             } 
    1348  
    1349             for (i = 0; i < ff->vfi->plane_cnt; ++i) { 
    1350                 data[i] = q; 
    1351                 q += vafp->plane_bytes[i]; 
    1352             } 
    1353             h = sws_scale(ff->sws_ctx, avframe.data, avframe.linesize, 0,  
    1354                           ff->dec_ctx->coded_height, data, vafp->strides); 
    1355             pj_assert((int)vafp->size.h == h); 
    1356 #endif 
    1357  
    13581332            pjmedia_format_id new_fmt_id; 
    13591333            pj_status_t status; 
     
    13831357            /* Notify application via the bit_info field of pjmedia_frame */ 
    13841358            output->bit_info = PJMEDIA_VID_CODEC_EVENT_FMT_CHANGED; 
     1359 
     1360            /* Check provided buffer size after format changed */ 
     1361            if (vafp->framebytes > output_buf_len) 
     1362                return PJ_ETOOSMALL; 
    13851363        } 
    1386  
    1387         /* Check provided buffer size after format changed */ 
    1388         //if (vafp->framebytes > output_buf_len) 
    1389             //return PJ_ETOOSMALL; 
    13901364 
    13911365        /* Get the decoded data */ 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c

    r3431 r3432  
    281281 
    282282    pj_bzero(param, sizeof(*param)); 
    283     if (di->info.dir & PJMEDIA_DIR_CAPTURE_RENDER) { 
     283    if (di->info.dir == PJMEDIA_DIR_CAPTURE_RENDER) { 
    284284        param->dir = PJMEDIA_DIR_CAPTURE_RENDER; 
    285285        param->cap_id = index; 
     
    751751    } 
    752752 
     753    if (frame->size==0 || frame->buf==NULL) 
     754        goto on_return; 
     755 
    753756    if (stream->surf) { 
    754757        if (SDL_MUSTLOCK(stream->surf)) { 
  • pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c

    r3431 r3432  
    8989#define THIS_FILE       "vid_streamutil.c" 
    9090 
     91 
     92/* If set, local renderer will be created to play original file */ 
    9193#define HAS_LOCAL_RENDERER_FOR_PLAY_FILE    1 
    92 #define DEF_RENDERER_WIDTH                  0 
    93 #define DEF_RENDERER_HEIGHT                 0 
     94 
     95 
     96/* Default width and height for the renderer, better be set to maximum 
     97 * acceptable size. 
     98 */ 
     99#define DEF_RENDERER_WIDTH                  640 
     100#define DEF_RENDERER_HEIGHT                 480 
     101 
    94102 
    95103/* Prototype */ 
     
    598606    if (play_file.file_name) { 
    599607        pjmedia_video_format_detail *file_vfd; 
    600         pjmedia_clock_param *clock_param; 
     608        pjmedia_clock_param clock_param; 
    601609 
    602610        /* Create file player */ 
Note: See TracChangeset for help on using the changeset viewer.