- Timestamp:
- Mar 1, 2011 5:40:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
r3425 r3432 1273 1273 PJ_ASSERT_RETURN(ff->dec_ctx, PJ_EINVALIDOP); 1274 1274 1275 /* Reset output frame bit info */ 1276 output->bit_info = 0; 1277 1275 1278 /* 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; 1277 1281 1278 1282 /* Init frame to receive the decoded data, the ffmpeg codec context will … … 1326 1330 ff->dec_ctx->coded_height != (int)vafp->size.h) 1327 1331 { 1328 #if 01329 // it should not be the codec responsibility to do resizing1330 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 #endif1357 1358 1332 pjmedia_format_id new_fmt_id; 1359 1333 pj_status_t status; … … 1383 1357 /* Notify application via the bit_info field of pjmedia_frame */ 1384 1358 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; 1385 1363 } 1386 1387 /* Check provided buffer size after format changed */1388 //if (vafp->framebytes > output_buf_len)1389 //return PJ_ETOOSMALL;1390 1364 1391 1365 /* Get the decoded data */
Note: See TracChangeset
for help on using the changeset viewer.