@@ -617,8 +617,7 @@ void autoConfig::TestBandwidthThreadV2(void)
617617 ul.unlock ();
618618 std::this_thread::sleep_for (std::chrono::milliseconds (250 ));
619619 }
620- dataWaitMs = (int )std::chrono::duration_cast<std::chrono::milliseconds>(
621- std::chrono::steady_clock::now () - dataStart).count ();
620+ dataWaitMs = (int )std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now () - dataStart).count ();
622621 }
623622
624623 if (!gotError) {
@@ -1732,11 +1731,25 @@ static void applyResults()
17321731 v.fps_den = (uint32_t )(runContext.idealFPSDen ? runContext.idealFPSDen : 1 );
17331732 v.output_width = ((uint32_t )runContext.idealResolutionCX ) & 0xFFFFFFFC ;
17341733 v.output_height = ((uint32_t )runContext.idealResolutionCY ) & 0xFFFFFFFE ;
1734+
1735+ blog (LOG_INFO , " applyResults: ctx=%p current=%ux%u@%u/%u requested=%ux%u@%u/%u" , video, video->output_width ,
1736+ video->output_height , video->fps_num , video->fps_den , v.output_width , v.output_height , v.fps_num , v.fps_den );
1737+
1738+ // Skip the libobs call when nothing changes — the common case where
1739+ // autoconfig picks the resolution/FPS the canvas is already running at.
1740+ // obs_set_video_info would otherwise return OBS_VIDEO_CURRENTLY_ACTIVE
1741+ // for any active video context (e.g. running preview).
1742+ if (video->fps_num == v.fps_num && video->fps_den == v.fps_den && video->output_width == v.output_width &&
1743+ video->output_height == v.output_height ) {
1744+ blog (LOG_INFO , " applyResults: ctx=%p no change, skipping obs_set_video_info" , video);
1745+ continue ;
1746+ }
1747+
17351748 int ret = obs_set_video_info (video, &v);
1736- std::lock_guard<std::mutex> lock (eventsMutex);
1737- events.push (AutoConfigInfo (" applied" , ret == OBS_VIDEO_SUCCESS ? " video" : (" video_failed_ret_" + std::to_string (ret)), (double )ret));
1749+ blog (ret == OBS_VIDEO_SUCCESS ? LOG_INFO : LOG_WARNING , " applyResults: ctx=%p obs_set_video_info returned %d" , video, ret);
17381750 if (ret != OBS_VIDEO_SUCCESS ) {
1739- blog (LOG_WARNING , " applyResults: obs_set_video_info returned %d" , ret);
1751+ std::lock_guard<std::mutex> lock (eventsMutex);
1752+ events.push (AutoConfigInfo (" error" , " video_failed_ret_" + std::to_string (ret), 0 ));
17401753 }
17411754 }
17421755
@@ -1759,8 +1772,7 @@ static void applyResults()
17591772 obs_data_set_string (settings, " server" , targetServer.c_str ());
17601773 obs_service_update (st.streaming ->service , settings);
17611774 obs_data_release (settings);
1762- std::lock_guard<std::mutex> lock (eventsMutex);
1763- events.push (AutoConfigInfo (" applied" , " service" , 0 ));
1775+ blog (LOG_INFO , " applyResults: target %llu: applied service server '%s'" , st.id , targetServer.c_str ());
17641776 }
17651777
17661778 // Streaming bitrate — three caps applied in order:
@@ -1794,8 +1806,7 @@ static void applyResults()
17941806 obs_data_set_int (encSettings, " bitrate" , (long long )finalBitrate);
17951807 obs_encoder_update (st.streaming ->videoEncoder , encSettings);
17961808 obs_data_release (encSettings);
1797- std::lock_guard<std::mutex> lock (eventsMutex);
1798- events.push (AutoConfigInfo (" applied" , " video_encoder" , 0 ));
1809+ blog (LOG_INFO , " applyResults: target %llu: applied video encoder bitrate %llu" , st.id , finalBitrate);
17991810 }
18001811
18011812 // Encoder type mismatch log (per-target)
@@ -1818,8 +1829,7 @@ static void applyResults()
18181829 obs_data_set_int (encSettings, " bitrate" , (long long )runContext.idealBitrate );
18191830 obs_encoder_update (recording->videoEncoder , encSettings);
18201831 obs_data_release (encSettings);
1821- std::lock_guard<std::mutex> lock (eventsMutex);
1822- events.push (AutoConfigInfo (" applied" , " recording_video_encoder" , 0 ));
1832+ blog (LOG_INFO , " applyResults: applied recording video encoder bitrate %llu" , runContext.idealBitrate );
18231833 }
18241834 });
18251835 }
0 commit comments