kinesis-video-archived-media client discards milliseconds from timestamps in list_fragments and get_clip #3255
Labels
bug
This issue is a confirmed bug.
needs-review
This issue or pull request needs review from a core team member.
p2
This is a standard priority issue
Describe the bug
I'm using the
kinesis-video-archived-media
client to fetch fragment information and MP4 clips from a KVS stream. Both thelist_fragments
method and theget_clip
method of the client expect aTimestampRange
object with aStartTimestamp
andEndTimestamp
. I'm supplying (UTC-timezoned)datetime.datetime
instances for each of those, and those instances have millisecond resolution.In both cases, the eventual request made to AWS appears to drop the millisecond information from the timestamps, resulting in me getting a different fragment list (or video clip range) from the one I expect.
Expected Behavior
I hoped for the millisecond information in the start timestamp and end timestamp to be preserved: the fragments themselves have time information that includes millisecond resolution, so it's useful to be able to use millisecond resolution to select the desired fragments.
Current Behavior
The requests succeeded, but returned fragments matched what would happen if the millisecond portion of the timestamps was being discarded. (By doing
boto3.set_stream_logger(name="botocore")
I was able to verify that this was in fact what was happening.)Reproduction Steps
Here's Python code that reproduces the issue for me. It needs a valid KVS
STREAM_NAME
to run.When I run this code, the logs include the following output:
Here the
StartTimestamp
has value1726138176
where I was expecting1726138176.5
, and similarly for theEndTimestamp
.I've verified that if I hack the serialization logic here then AWS is happy to accept timestamps with millisecond resolution, and to return the appropriate fragment list as a result.
Possible Solution
It looks as though the serialization logic for the timestamp range start and end ends up using
_timestamp_unixtimestamp
, which is where the millisecond information is discarded.I don't have enough familiarity with botocore internals (yet) to suggest a fix, but it looks as though the specification here should be using something other than plain old
Timestamp
for the shape. I seeTimestampMilliseconds
in some other places; can that be used here?Additional Information/Context
No response
SDK version used
botocore 1.34.33
Environment details (OS name and version, etc.)
macOS 14.6.1, Python 3.8
The text was updated successfully, but these errors were encountered: