Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jigong
Beginner
23 Views

Should we have to close the decoder's MFXVideosession when change resource?

In our application, we have 6 decoders and their MFXVideosession are joined together. One of the decoders may be interrupted and provided a new video. For example, one decoder is playing a mp4 video, now we want to stop video and to receive a camera H264 stream. But other decoders are still asked to work as before (not interrupted). Should we have to close the decoder's MFXVideosession, or just reset decoder as Media SDK' sample_decode does?
Thanks
Jiuxiang
0 Kudos
4 Replies
Anthony_P_Intel
Employee
23 Views

Hi Jiuxiang,
If the parameters and required resources of the stream are changing you will likely need to do more than reset. I beleive you can setup a new decoder without closing the MFXVideoSession however. I will investigate.

-Tony
jigong
Beginner
23 Views

Hi Tony,
Yes, the parameter (e.g. video resolution) maybe change. But all of them are H264 stream with AVC type. The folloing is the method that we are using to reset of decoder. Is it enough? Should I deleteMFXVideoDECODE* before I setup a new MFXVideoDECODE?
mfxStatus H264Decoder::ResetDecoder(sInputParams *pParams)
{
mfxStatus sts = MFX_ERR_NONE;
// close decoder
sts = m_pmfxDEC->Close();
MSDK_IGNORE_MFX_STS(sts, MFX_ERR_NOT_INITIALIZED);
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
// free allocated frames
DeleteFrames();
// initialize parameters with values from parsed header
sts = InitMfxParams(pParams);
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
// allocate frames prior to decoder initialization (if allocator used as external)
sts = AllocFrames();
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
// init decoder
sts = m_pmfxDEC->Init(&m_mfxVideoParams);
MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
return MFX_ERR_NONE;
}
Thanks.
Jiuxiang
Anthony_P_Intel
Employee
23 Views

Hi Jiuxiang,

It looks like your code is good. The call to m_pmfxDEC->Close() exectutes all the same steps thatdeleting and creating a new MFXVideoDecode object would do, so there is not reason for you to do any more than what your code is currently doing.

Thank you for the question.

-Tony
jigong
Beginner
23 Views

Hi Tony,
It works as you said after I fixed the data stream pipeline.
Thanks.
Jiuxiang