Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only update stats when resolution is valid #280

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/MediaFrameListenerBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,19 @@ void MediaFrameListenerBridge::onMediaFrame(DWORD ignored, const MediaFrame& fra
{
//Convert
auto videoFrame = std::static_pointer_cast<VideoFrame>(frame);
//Set width and height
width = videoFrame->GetWidth();
height = videoFrame->GetHeight();

if (videoFrame->GetWidth() != 0 && videoFrame->GetHeight() != 0)
{
//Set width and height
width = videoFrame->GetWidth();
harryz2000 marked this conversation as resolved.
Show resolved Hide resolved
height = videoFrame->GetHeight();
}
else if (width != 0 && height != 0)
{
// Set as per previous width/height
videoFrame->SetWidth(width);
harryz2000 marked this conversation as resolved.
Show resolved Hide resolved
videoFrame->SetHeight(height);
}

// Increase bframes
accumulatorBFrames.Update(now.count(), videoFrame->IsBFrame() ? 1 : 0);
Expand Down Expand Up @@ -396,6 +406,17 @@ void MediaFrameListenerBridge::onMediaFrame(DWORD ignored, const MediaFrame& fra

//TODO: move out of here
VideoLayerSelector::GetLayerIds(packet);

// Set frame resolution if needed
if ((video->GetWidth() == 0 || video->GetHeight() == 0) &&
(packet->GetWidth() != 0 && packet->GetHeight() != 0))
{
video->SetWidth(packet->GetWidth());
video->SetHeight(packet->GetHeight());

width = video->GetWidth();
harryz2000 marked this conversation as resolved.
Show resolved Hide resolved
height = video->GetHeight();
harryz2000 marked this conversation as resolved.
Show resolved Hide resolved
}

//Get media frame target bitrate or hint
auto targetBitrate = video->GetTargetBitrate() ? video->GetTargetBitrate() : targetBitrateHint;
Expand Down
Loading