diff options
Diffstat (limited to 'Swiften/ScreenSharing/VP8Decoder.cpp')
-rw-r--r-- | Swiften/ScreenSharing/VP8Decoder.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Swiften/ScreenSharing/VP8Decoder.cpp b/Swiften/ScreenSharing/VP8Decoder.cpp index 90f5101..2c86b68 100644 --- a/Swiften/ScreenSharing/VP8Decoder.cpp +++ b/Swiften/ScreenSharing/VP8Decoder.cpp @@ -47,14 +47,24 @@ void VP8Decoder::updateCodecConfig() void VP8Decoder::decodeFrame(const std::vector<uint8_t>& frame, int pictureID) { + SWIFT_LOG(debug) << "decodeFrame, pictureID = " << pictureID << std::endl; // Decode the frame - vpx_codec_err_t err = vpx_codec_decode(&codecContext, &frame[0], frame.size(), NULL, 0); + vpx_codec_err_t err = vpx_codec_decode(&codecContext, frame.data(), frame.size(), 0, 0); if (err) { SWIFT_LOG(debug) << "VP8 Decoder: Failed to decode frame, " << vpx_codec_err_to_string(err) << std::endl; - onNewFrameDecoded(pictureID, false); - return; } else { - onNewFrameDecoded(pictureID, true); + } + + int reference_updates = 0; + vpx_codec_control(&codecContext, VP8D_GET_LAST_REF_UPDATES, &reference_updates); + int corrupted = 0; + vpx_codec_control(&codecContext, VP8D_GET_FRAME_CORRUPTED, &corrupted); + + if (!corrupted) { + if ((reference_updates & VP8_GOLD_FRAME) || (reference_updates & VP8_ALTR_FRAME)) + onNewRef(pictureID); + } else { + onCorrupted(pictureID); } vpx_codec_iter_t iter = NULL; @@ -62,6 +72,7 @@ void VP8Decoder::decodeFrame(const std::vector<uint8_t>& frame, int pictureID) while ((decodedImg = vpx_codec_get_frame(&codecContext, &iter))) { Image rgbImg = convertYV12toRGB(decodedImg); onNewImageAvailable(rgbImg); + /* // Restore ref from last save if corrupted, else save the ref int corrupted = 0; vpx_codec_control(&codecContext, VP8D_GET_FRAME_CORRUPTED, &corrupted); @@ -86,6 +97,7 @@ void VP8Decoder::decodeFrame(const std::vector<uint8_t>& frame, int pictureID) } vpx_codec_control(&codecContext, VP8_COPY_REFERENCE, refFrame); } + */ } } |