Commit 628b60f00f for aom

commit 628b60f00fe61a7cd90d809bca793e1024664190
Author: Marco Paniconi <marpan@google.com>
Date:   Wed Oct 21 17:35:18 2026 +0000

    Only check 32-bit pts bound when decoder model timing is used

    In av1_encode_strategy(), cm->frame_presentation_time is a 32-bit field
    only written to the bitstream in write_tu_pts_info() when
    seq_params->decoder_model_info_present_flag == 1 and
    seq_params->timing_info.equal_picture_interval == 0.

    Previously, av1_encode_strategy() unconditionally converted the 64-bit
    relative timestamp (*time_stamp) to timebase units and returned
    AOM_CODEC_ERROR if pts64 > UINT32_MAX, even when decoder model timing
    info was not enabled (the default). In long-running real-time encoding
    sessions using a 90 kHz RTP clock timebase (g_timebase = {1, 90000}),
    the relative timestamp exceeds UINT32_MAX after ~13.26 hours (2^32 /
    90000 seconds), causing aom_codec_encode() to fail with AOM_CODEC_ERROR.

    Guard the UINT32_MAX check and cm->frame_presentation_time assignment
    behind decoder_model_info_present_flag && !equal_picture_interval,
    matching write_tu_pts_info() in bitstream.c.

    Bug: b:444969593
    Change-Id: I4585e844318ec341742f35407461825a9023b2c4

diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 02be53f227..da273dd8bc 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1512,11 +1512,15 @@ int av1_encode_strategy(AV1_COMP *const cpi, size_t *const size,
           cm->seq_params->film_grain_params_present;
     }
 #endif
-    // only one operating point supported now
-    const int64_t pts64 = ticks_to_timebase_units(timestamp_ratio, *time_stamp);
-    if (pts64 < 0 || pts64 > UINT32_MAX) return AOM_CODEC_ERROR;
-
-    cm->frame_presentation_time = (uint32_t)pts64;
+    if (cm->seq_params->decoder_model_info_present_flag &&
+        cm->seq_params->timing_info.equal_picture_interval == 0) {
+      // only one operating point supported now
+      const int64_t pts64 =
+          ticks_to_timebase_units(timestamp_ratio, *time_stamp);
+      if (pts64 < 0 || pts64 > UINT32_MAX) return AOM_CODEC_ERROR;
+
+      cm->frame_presentation_time = (uint32_t)pts64;
+    }
   }

 #if CONFIG_COLLECT_COMPONENT_TIMING