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 all 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
18 changes: 15 additions & 3 deletions src/MediaFrameListenerBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,13 @@ 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();
}

// Increase bframes
accumulatorBFrames.Update(now.count(), videoFrame->IsBFrame() ? 1 : 0);
Expand Down Expand Up @@ -396,6 +400,14 @@ 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))
{
width = packet->GetWidth();
height = packet->GetHeight();
}

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