Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3058 Discussions

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

jigong
Beginner
328 Views
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
328 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
0 Kudos
jigong
Beginner
328 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
0 Kudos
Anthony_P_Intel
Employee
328 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
0 Kudos
jigong
Beginner
328 Views
Hi Tony,
It works as you said after I fixed the data stream pipeline.
Thanks.
Jiuxiang
0 Kudos
Reply