From d541c5409324bd7fb0cf0b594a0cddbf977bff6b Mon Sep 17 00:00:00 2001 From: igorshevach Date: Mon, 9 Sep 2024 12:49:00 +0300 Subject: [PATCH] check for media info self assignment --- transcoder/transcode/transcode_session.c | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/transcoder/transcode/transcode_session.c b/transcoder/transcode/transcode_session.c index f781d485..33aa6822 100644 --- a/transcoder/transcode/transcode_session.c +++ b/transcoder/transcode/transcode_session.c @@ -112,18 +112,21 @@ void transcode_session_get_ack_frame_id(transcode_session_t *ctx,kmp_frame_posit int transcode_session_set_media_info(transcode_session_t *ctx,transcode_mediaInfo_t* newMediaInfo) { if (ctx->currentMediaInfo) { - AVCodecParameters *currentCodecParams=ctx->currentMediaInfo->codecParams; - AVCodecParameters *newCodecParams=newMediaInfo->codecParams; - bool changed=newCodecParams->width!=currentCodecParams->width || - newCodecParams->height!=currentCodecParams->height || - newCodecParams->extradata_size!=currentCodecParams->extradata_size; - - if (currentCodecParams->extradata_size>0 && - newCodecParams->extradata!=NULL && - currentCodecParams->extradata!=NULL - // FIXME: uncomment memcp!!! - /*&& 0!=memcmp(newCodecParams->extradata,currentCodecParams->extradata,currentCodecParams->extradata_size)*/) - changed=true; + bool changed = false; + if(ctx->currentMediaInfo != newMediaInfo) { + AVCodecParameters *currentCodecParams=ctx->currentMediaInfo->codecParams; + AVCodecParameters *newCodecParams=newMediaInfo->codecParams; + changed=newCodecParams->width!=currentCodecParams->width || + newCodecParams->height!=currentCodecParams->height || + newCodecParams->extradata_size!=currentCodecParams->extradata_size; + + if (currentCodecParams->extradata_size>0 && + newCodecParams->extradata!=NULL && + currentCodecParams->extradata!=NULL + // FIXME: uncomment memcp!!! + /*&& 0!=memcmp(newCodecParams->extradata,currentCodecParams->extradata,currentCodecParams->extradata_size)*/) + changed=true; + } if (!changed) {