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

ffmpeg: silence warnings #23

Merged
merged 1 commit into from
Dec 26, 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
10 changes: 8 additions & 2 deletions src/modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ struct AVProducer::Impl
timer decode_timer;

int warning_debounce = 0;
uint8_t warning_count = 0;
const uint8_t max_warnings = 5;

while (!thread_.interruption_requested()) {
{
Expand Down Expand Up @@ -904,14 +906,18 @@ struct AVProducer::Impl

if ((!video_filter_.frame && !video_filter_.eof) || (!audio_filter_.frame && !audio_filter_.eof)) {
if (!progress) {
if (warning_debounce++ % 500 == 100) {
if (warning_debounce++ % 500 == 100 && warning_count < max_warnings) {
if (!video_filter_.frame && !video_filter_.eof) {
CASPAR_LOG(warning) << print() << " Waiting for video frame...";
} else if (!audio_filter_.frame && !audio_filter_.eof) {
CASPAR_LOG(warning) << print() << " Waiting for audio frame...";
} else {
CASPAR_LOG(warning) << print() << " Waiting for frame...";
}
warning_count++;
if(warning_count == max_warnings) {
CASPAR_LOG(warning) << print() << " Too many warnings. Silencing.";
}
}

// TODO (perf): Avoid live loop.
Expand All @@ -920,7 +926,7 @@ struct AVProducer::Impl
continue;
}

warning_debounce = 0;
warning_debounce = warning_count = 0;

// TODO (fix)
// if (start_ != AV_NOPTS_VALUE && frame.pts < start_) {
Expand Down
Loading