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.
Related Issues (20)
- Play DSD in DoP mode will heard noise in the sound HOT 13
- mpg123 header includes seemingly using incorrect include type HOT 2
- Issues with building macOS Sample Player HOT 1
- Can't run in physical device HOT 3
- The opus file is seriously distorted, and only one side of the speaker has sound. HOT 3
- When the speex file is playing, only one side of the speaker has sound, and SFBAudioPlayer.totalTime is nil HOT 3
- I keep getting an error when converting to apple native format, like m4a aac HOT 4
- Total frames not calculated for Ogg Speex streams HOT 1
- When encoding to mp3, the bitrate is always 128kbps HOT 5
- LAME encoder settings are confusing HOT 1
- 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
- Looping a decoder region doesn't work HOT 1
- playReturningError failure HOT 6
- How to changed speed
- Importing Package HOT 2
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.