Hi experts,
This is Jim and I am using libvpx for a voip project. Now I am confused with the method of
vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
const uint8_t *data,
unsigned int data_sz,
void *user_priv,
long deadline);
How can I to get the previously decoded frame when I found something wrong with the current frame? According to the comment of
*\param[in] data Pointer to this block of new coded data. If
* NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
* for the previously decoded frame.
Can I just call vpx_codec_decode() to tell the decoder to use last frame by setting the data to NULL and the data_sz to 0?
Or the application should buffer the correct frame, and to implement a call back for event of VPX_CODEC_CB_PUT_FRAME? If so, how to get that?
Looking forwards to your answer! Your help will be appreciated!
Regards
Jim
Hi vp8 experts,
Second try. Can anyone help?
Thanks,
Jim
Jim, thanks for your kindly help.
While in poor networks condition, the sreen becomes green. To improve the user experience, I think that we can let the screen freeze by using last successfully decoded frame to display, when the result of vpx_codec_decode() indicate that the current frame is corrupt.
So now my understand is :
step 1) Use vpx_codec_decode(vpx_codec_ctx_t *ctx,
const uint8_t *data,
unsigned int data_sz,
void *user_priv,
long deadline);
to decode rtp package data, and if the result is OK, and then get into step 2)
step 2) Use vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
vpx_codec_iter_t *iter)
to get the decoded frame, here the application should maintain these frames(the return value for vpx_codec_get_frame() ) if we want to use them in the future, right ? Another question here, we call vpx_codec_decode() one time, does it means that we can get one image in step 2), or some time we get more than one image ?
And in the case of the current frame to be decoded is a corrupt frame, in step 1) we get a result of VPX_CODEC_CORRUPT_FRAME. We can use the image we maintain in last step 2) after last successfully decoded frame in last step 1) , right ?
I also confused with the the comment of vpx_codec_decode() :
*\param[in] data Pointer to this block of new coded data. If
* NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
* for the previously decoded frame.