Skip to content

Commit 2835bb3

Browse files
committed
fix: Throw in stream optimization
1 parent b551e69 commit 2835bb3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/c2pa/c2pa.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,13 +746,11 @@ def __init__(self, file):
746746
self._initialized = False
747747
self._stream = None
748748

749-
# Generate unique stream ID with timestamp
750-
timestamp = int(time.time() * 1000) # milliseconds since epoch
751-
749+
# Generate unique stream ID efficiently using object ID and counter
752750
# Safely increment stream ID with overflow protection
753751
if Stream._next_stream_id >= Stream._MAX_STREAM_ID:
754752
Stream._next_stream_id = 0 # Reset to 0 if we hit the maximum
755-
self._stream_id = f"{timestamp}-{Stream._next_stream_id}"
753+
self._stream_id = f"{id(self)}-{Stream._next_stream_id}"
756754
Stream._next_stream_id += 1
757755

758756
# Rest of the existing initialization code...

0 commit comments

Comments
 (0)