microsoft / microsoft/FFmpegInterop
FileStreamRead never gets a result from pStream->Read
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 319
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use FFmpegInterop with network streams, by using the following code:
var request = new HttpRequestMessage(HttpMethod.Get, uri);
var response = await new HttpClient().SendAsync(request);
var stream = await response.Content.ReadAsStreamAsync();
FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromStream(stream.AsRandomAccessStream(),
forceDecodeAudio, forceDecodeVideo, options);
However, FileStreamRead in FFmpegInteropMSS.cpp never gets a result from pStream->Read. I've also tried a custom implementation of IRandomAccessStream that allows seeking by using ranged (http) requests. In that case Seek is called once with position 0, then ReadAsync is called (with count of 16384), it returns but the process never continues at the pStream->Read call.
The ReadAsync method uses async and I'm not sure how CreateStreamFromRandomAccessStream handles this from it's sync Read method, but it almost seems like it can't switch back to the context where the FFmpegInterop call was made.
I'm not sure if this approach is even supposed to work, but I also don't see why it wouldn't work. Any advice is appreciated!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in FFmpegInteropMSS.cpp at FileStreamRead and the pStream->Read call, then trace how CreateStreamFromRandomAccessStream bridges the synchronous Read path to ReadAsync. Reproduce the network-stream case described in the issue and compare it with the custom ranged IRandomAccessStream implementation. Done means identifying why the read does not complete and confirming the fix with a successful stream read.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100