Comments (3)
I think this is the same issue discussed in #206 and I think it boils down to treating -openReturningError:
synchronously when it is inherently asynchronous in this case due to network requests.
This problem occurs because there are attempts to read data from the input source (via sf_open_virtual
in the case of WAVE, but it will differ by format) before the NSURLSessionDataTask
has made any calls to the delegate returning data from the request. When this happens the input source returns a zero length which is typically reported as an unsupported format.
I feel like this is a design flaw in the way that HTTP input sources are handled. Years ago HTTP input was implemented using CFReadStream
(see https://github.com/sbooth/SFBAudioEngine/blob/legacy/Input/HTTPInputSource.cpp if you're curious) which seemed to work at the time with the library's architecture. In the transition to Objective-C and Swift CFReadStream
was replaced with the current design.
I don't have a great fix off the top of my head, but one possibility is exposing SFBHTTPInputSource
as a public class and requiring users to ensure the network has returned data before trying to create a decoder from the input source. It's also possible that the library could handle that internally although I'm not sure what that would entail.
In a perfect world perhaps all reads would be asynchronous (taking a completion handler in Objective-C and using async
in Swift) but that would be significant change to the way things work.
Bringing in @NattyNarwhal for any suggestions.
from sfbaudioengine.
I moved my application to AVFoundation, which from what I observe (could be inaccurate!) seems block only to load just enough of the file (metadata, maybe initial audio frames), then continues to load the rest in asynchronously behind the scenes; file progress is observable. You can also set an option to block a bit longer to load more data for more accurate seeks if the container can't be accurate about it.
In the SFBHTTPInputSource case, it seemed all the libraries it delegates to would fail because nothing was loaded of the file yet.
from sfbaudioengine.
For now I've removed SFBHTTPInputSource
.
from sfbaudioengine.
Related Issues (20)
- Whatβs the role of SFBFFmpegDecoder HOT 1
- How to set the output sampleRate HOT 1
- OPUS file duration in milliseconds HOT 3
- SFBFLACDecoder - decodeIntoBuffer - not decoding all frames HOT 5
- Add .podspec for Cocoapods HOT 1
- Looping a decoder region doesn't work HOT 1
- playReturningError failure HOT 6
- How to changed speed
- Importing Package HOT 2
- macOS 14+ dependencies? HOT 6
- Unable to convert some audio formats
- AudioDevice HOT 3
- Encoding .wav to .oggOpus HOT 8
- Does the pre-render callback still exist? HOT 1
- Issues queueing and dequeueing Opus tracks HOT 8
- Retain cycle in `SFBAudioPlayerNode` prevents deallocation HOT 1
- MOD files repeat endlessly HOT 4
- Replace dumb with libopenmpt for MOD decoding
- SPM can't add package HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfbaudioengine.