- if( !ret ) {
- if(got_packet && avctx->coded_frame) {
- avctx->coded_frame->pts = avpkt.pts;
- avctx->coded_frame->key_frame = !!(avpkt.flags & AV_PKT_FLAG_KEY);
- }
+ if( ret < 0 ) {
+ char errmsg[BCSTRLEN];
+ av_strerror(ret, errmsg, sizeof(errmsg));
+ fprintf(stderr, "avcodec_encode_audio2 failed. \n%s\n", errmsg);