Video not being decoded fully

Hello,

I have an issue where the entire video is not being decoded using the GPU. For some odd reason the video stops some frames before the end. I have traced it down to the HandlePictureDisplay callback function. I added counters to the HandlePictureDecode and HandlePictureDisplay to verify they are both counting the same amount of frames but i found the HandlePictureDisplay stops before the video is done. The HandlePictureDecode callback is counting the correct amount of frames though. Do you know why this could be?