diff --git a/src/context.c b/src/context.c index 09706eb..a46317f 100644 --- a/src/context.c +++ b/src/context.c @@ -254,6 +254,7 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, goto error; } memset(&context_object->dpb, 0, sizeof(context_object->dpb)); + context_object->timestamp_counter = 0; /* iter9 α-7 */ /* * Initialize the OUTPUT (bitstream-input) buffer pool. Sized by diff --git a/src/context.h b/src/context.h index 50d93d5..66cb08d 100644 --- a/src/context.h +++ b/src/context.h @@ -55,6 +55,15 @@ struct object_context { struct h264_dpb dpb; bool h264_start_code; + /* + * iter9 α-7: monotonic per-context timestamp counter (us). Replaces + * gettimeofday in EndPicture so DPB.reference_ts / OUTPUT QBUF ts + * are small values matching ffmpeg-v4l2request's pattern. Placed + * here (object_context) not driver_data per Phase 5 IMP-1 to avoid + * cross-context collisions. + */ + uint64_t timestamp_counter; + /* fresnel-fourier iter4: VP9 loop-filter delta state, persisted across * frames per kernel UAPI :2578 ("If this syntax * element is not present in the bitstream, users should pass its last diff --git a/src/picture.c b/src/picture.c index edb43d8..f72828b 100644 --- a/src/picture.c +++ b/src/picture.c @@ -461,7 +461,19 @@ VAStatus RequestEndPicture(VADriverContextP context, VAContextID context_id) if (surface_object == NULL) return VA_STATUS_ERROR_INVALID_SURFACE; - gettimeofday(&surface_object->timestamp, NULL); + /* + * iter9 α-7: monotonic per-context counter instead of gettimeofday, + * so DPB.reference_ts / OUTPUT QBUF ts stay small (matches + * ffmpeg-v4l2request's pattern). gettimeofday's giant ns may or may + * not be load-bearing for rkvdec's reference resolution — Phase 5 + * reviewer flagged this as low-probability (VP9/MPEG-2 use the same + * pattern and PASS), but this is the only remaining wire-byte diff. + */ + context_object->timestamp_counter++; + surface_object->timestamp.tv_sec = + (time_t)(context_object->timestamp_counter / 1000000); + surface_object->timestamp.tv_usec = + (suseconds_t)(context_object->timestamp_counter % 1000000); /* * iter6: request_fd was bound to the surface in BeginPicture from