Skip to content

Commit e5dd376

Browse files
authored
Merge pull request #110 from beetbox/sam/gstreamer-1.18-fix
gstdec: Update in line with GStreamer 1.18 API break
2 parents a4d29ab + 53e23f1 commit e5dd376

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ convert compressed audio files to WAV files.
7070
Version History
7171
---------------
7272

73+
2.1.9
74+
Work correctly with GStreamer 1.18 and later (thanks to @ssssam)
75+
7376
2.1.8
7477
Fix an unhandled ``OSError`` when FFmpeg is not installed.
7578

audioread/gstdec.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,14 @@ def _new_sample(self, sink):
321321
mem = buf.get_all_memory()
322322
success, info = mem.map(Gst.MapFlags.READ)
323323
if success:
324-
data = info.data
324+
if isinstance(info.data, memoryview):
325+
# We need to copy the data as the memoryview is released
326+
# when we call mem.unmap()
327+
data = bytes(info.data)
328+
else:
329+
# GStreamer Python bindings <= 1.16 return a copy of the
330+
# data as bytes()
331+
data = info.data
325332
mem.unmap(info)
326333
self.queue.put(data)
327334
else:

0 commit comments

Comments
 (0)