Skip to content

Commit bfc3fec

Browse files
authored
Merge pull request #116 from Bomme/default_buffer_size_ffdec
set default block size in FFmpegAudioFile to io.DEFAULT_BUFFER_SIZE
2 parents 39a7363 + ebc0cf5 commit bfc3fec

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
python-version: ${{ matrix.python }}
1919
- name: Install ffmpeg
20-
run: sudo apt install -y ffmpeg
20+
run: sudo apt install -y --no-install-recommends ffmpeg
2121
- name: Install tox and any other packages
2222
run: pip install tox
2323
- name: Run tox

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Version History
7272
3.0.0
7373
Drop support for Python 2 and older versions of Python 3. The library now
7474
requires Python 3.6+.
75+
Increase default block size in FFmpegAudioFile to get slightly faster file reading.
7576

7677
2.1.9
7778
Work correctly with GStreamer 1.18 and later (thanks to @ssssam).

audioread/ffdec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import sys
2424
import threading
2525
import time
26+
from io import DEFAULT_BUFFER_SIZE
2627

2728
from .exceptions import DecodeError
2829

@@ -120,7 +121,7 @@ def available():
120121

121122
class FFmpegAudioFile:
122123
"""An audio file decoded by the ffmpeg command-line utility."""
123-
def __init__(self, filename, block_size=4096):
124+
def __init__(self, filename, block_size=DEFAULT_BUFFER_SIZE):
124125
# On Windows, we need to disable the subprocess's crash dialog
125126
# in case it dies. Passing SEM_NOGPFAULTERRORBOX to SetErrorMode
126127
# disables this behavior.

0 commit comments

Comments
 (0)