Skip to content

Commit

Permalink
[VCM] properly determine that there's no mem left in the frame buffer…
Browse files Browse the repository at this point in the history
… + fix image loading issue
  • Loading branch information
yuyoyuppe committed Apr 12, 2021
1 parent 417a0c1 commit f0e29f7
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ bool OverwriteFrame(IMediaSample* frame, wil::com_ptr_nothrow<IMFSample>& image)
return false;
}
bool success = true;
if (imageSize > frameSize)
if (imageSize > frameSize && failed(frame->SetActualDataLength(imageSize)))
{
char buf[512]{};
sprintf_s(buf, "Error: overlay image size %ld is larger than frame size %d - truncated.", imageSize, frameSize);
sprintf_s(buf, "Error: overlay image size %lu is larger than frame size %lu", imageSize, frameSize);
LOG(buf);
imageSize = frameSize;
success = false;
Expand Down Expand Up @@ -443,14 +443,15 @@ VideoCaptureProxyFilter::VideoCaptureProxyFilter() :
continue;
}

const auto newSettings = SyncCurrentSettings();
auto newSettings = SyncCurrentSettings();
if (newSettings.webcamDisabled)
{
bool overwritten = OverwriteFrame(_pending_frame, _overlayImage ? _overlayImage : _blankImage);
while(!overwritten && _overlayImage && newSettings.overlayImage)
while (!overwritten && _overlayImage)
{
_overlayImage.reset();
if (!lowerJpgQualityModes.empty())
newSettings = SyncCurrentSettings();
if (!lowerJpgQualityModes.empty() && newSettings.overlayImage)
{
const float quality = lowerJpgQualityModes.back();
lowerJpgQualityModes.pop_back();
Expand Down

0 comments on commit f0e29f7

Please sign in to comment.