FIX: reset decode buffer zero when scale width changed
Change-Id: Iaa2f99111dd5f7228b7b25e1be0a8cbdbfe982a6 Jira: STUDIO-8422
This commit is contained in:
parent
0263b6d2bd
commit
659ebc7d07
|
@ -76,8 +76,13 @@ bool AVVideoDecoder::toWxImage(wxImage &image, wxSize const &size2)
|
|||
if (!size1.IsFullySpecified())
|
||||
size1 = {frame_->width, frame_->height };
|
||||
auto size = size1;
|
||||
if (size.GetWidth() & 0x0f)
|
||||
if (size.GetWidth() & 0x0f) {
|
||||
size.SetWidth((size.GetWidth() & ~0x0f) + 0x10);
|
||||
if (size.GetWidth() != width_) {
|
||||
std::fill(bits_.begin(), bits_.end(), 0);
|
||||
width_ = size.GetWidth();
|
||||
}
|
||||
}
|
||||
AVPixelFormat wxFmt = AV_PIX_FMT_RGB24;
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
|
@ -112,8 +117,13 @@ bool AVVideoDecoder::toWxBitmap(wxBitmap &bitmap, wxSize const &size2)
|
|||
if (!size1.IsFullySpecified())
|
||||
size1 = {frame_->width, frame_->height };
|
||||
auto size = size1;
|
||||
if (size.GetWidth() & 0x0f)
|
||||
if (size.GetWidth() & 0x0f) {
|
||||
size.SetWidth((size.GetWidth() & ~0x0f) + 0x10);
|
||||
if (size.GetWidth() != width_) {
|
||||
std::fill(bits_.begin(), bits_.end(), 0);
|
||||
width_ = size.GetWidth();
|
||||
}
|
||||
}
|
||||
AVPixelFormat wxFmt = AV_PIX_FMT_RGB32;
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
|
|
|
@ -34,6 +34,7 @@ private:
|
|||
AVFrame * frame_ = nullptr;
|
||||
SwsContext * sws_ctx_ = nullptr;
|
||||
bool got_frame_ = false;
|
||||
int width_ { 0 }; // scale result width
|
||||
std::vector<uint8_t> bits_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue