Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyogg/opus_buffered_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ def buffered_encode(self,
)
pcm_ctypes = Buffer.from_buffer(pcm_bytes)

samples_multiplier = 48000 // self._samples_per_second
# Either store the encoded packet to return at the end of the
# method or immediately call the callback with the encoded
# packet.
def store_or_callback(encoded_packet: memoryview,
samples: int,
end_of_stream: bool = False) -> None:
# As far as the audio is decoded in 48kHz, the position in a stream should be stored
# according to this rate, not the original one
samples *= samples_multiplier
if callback is None:
# Store the result
results.append((
Expand Down