Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow more than one candidate backends #1441

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
12 changes: 0 additions & 12 deletions lhotse/audio/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ def handles_special_case(self, path_or_fd: Union[Pathlike, FileObject]) -> bool:
and not torchaudio_ffmpeg_backend_available()
):
return True # prefer this to old torchaudio for file IO
if isinstance(path_or_fd, (Path, str)) and str(path_or_fd).endswith(".opus"):
return True # use libnsdfile for OPUS
return False

def is_applicable(self, path_or_fd: Union[Pathlike, FileObject]) -> bool:
Expand Down Expand Up @@ -609,11 +607,6 @@ def read_audio(
if b.handles_special_case(path_or_fd):
candidates.append(b)

assert len(candidates) < 2, (
f"CompositeAudioBackend has more than one sub-backend that "
f"handles a given special case for input '{path_or_fd}'"
)

if len(candidates) == 1:
try:
return candidates[0].read_audio(
Expand Down Expand Up @@ -718,11 +711,6 @@ def info(
if b.handles_special_case(path_or_fd):
candidates.append(b)

assert len(candidates) < 2, (
f"CompositeAudioBackend has more than one sub-backend that "
f"handles a given special case for input '{path_or_fd}'"
)

if len(candidates) == 1:
try:
return candidates[0].info(path_or_fd=path_or_fd)
Expand Down
Loading