microsoft / microsoft/FFmpegInterop

FileStreamRead never gets a result from pStream->Read

Open
#111 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.