Skip to content

Commit

Permalink
Fixed frame handling when no resampling was required.
Browse files Browse the repository at this point in the history
return bytes(), since .to_bytes() (py2) is now deprecated.
  • Loading branch information
systemcrash committed Jan 1, 2023
1 parent 6f3c1ce commit 2af912c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ap2/connections/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ def process(self, rtp):
try:
for frame in self.codecContext.decode(packet):
frame = self.resampler.resample(frame)
return frame.planes[0].to_bytes()
if len(frame) == 1: # if no resampling was needed, resample returns [frame]
frame = frame[0]
return bytes(frame.planes[0])
except ValueError as e:
self.audio_screen_logger.error(repr(e))
pass # noqa
Expand Down

0 comments on commit 2af912c

Please sign in to comment.