Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

怎么样才能推自己的图像数据出去 How to push out my own image data #240

Closed
yangjieshao opened this issue Mar 28, 2020 · 11 comments
Labels
need info More information is needed from the author to answer

Comments

@yangjieshao
Copy link

yangjieshao commented Mar 28, 2020

在net core3.1
作为服务器端 (命令行程序) As a server (command line program)
视频源是通过第三方提供的数据接口获取的帧画面
The video source is the frame obtained through the data interface provided by the third party
怎么样才能把这个帧画面推送出去呢
How to push this frame out

另外

var config = new PeerConnectionConfiguration
{
    IceServers = new List<IceServer> {
            //new IceServer{ Urls = { "stun:stun.l.google.com:19302" } }
        }
};
 await pc.InitializeAsync(config);

程序直接崩溃,返回值是 -1073740791 (0xc0000409)

@yangjieshao yangjieshao changed the title 怎么样才能推自己的图像数据出去 怎么样才能推自己的图像数据出去 How to push out my own image data Mar 28, 2020
@djee-ms
Copy link
Member

djee-ms commented Mar 28, 2020

Hi @yangjieshao,

If I understand what you want, in order to use a custom video source instead of a webcam you need to use ExternalVideoTrackSource, which is only available on master so needs to be built from sources.

I have no idea about the block of code nor the error you pasted, I will need some more context or some translation.

@djee-ms djee-ms added the need info More information is needed from the author to answer label Mar 28, 2020
@yangjieshao
Copy link
Author

这些是我从例子上复制的代码,并使用nuget安装了Microsoft.MixedReality.WebRTC.1.0.3
These are the code I copied from the example, And use nuget to install Microsoft. Mixedreality. Webrtc. 1.0.3

var deviceList = await PeerConnection.GetVideoCaptureDevicesAsync();
// For example, print them to the standard output
foreach (var device in deviceList)
{
        Console.WriteLine($"Found webcam {device.name} (id: {device.id})");
}

// Create a new peer connection automatically disposed at the end of the program
using var pc = new PeerConnection();

 // Initialize the connection with a STUN server to allow remote access
 var config = new PeerConnectionConfiguration
{
        IceServers = new List<IceServer> {
                 // new IceServer{ Urls = { "stun:stun.l.google.com:19302" } }
         }
};
await pc.InitializeAsync(config);
Console.WriteLine("Peer connection initialized.");

在await pc.InitializeAsync(config); 等待了一段时间后程序就崩溃了
After waiting for "await pc.initializeasync (config);" the program crashes

exit code: -1073740791 (0xc0000409)。

@yangjieshao
Copy link
Author

I try to clone all modules
However, due to network reasons, downloading always fails
I try to rebuild the solution but
image
If you can, can you zip the all the external folder

@djee-ms
Copy link
Member

djee-ms commented Mar 30, 2020

This file is downloaded from nuget.org, from one of the Microsoft.MixedReality.WebRTC.Native.Core.* packages such as this one.

The external folder on my machine is 25GB, no I cannot ZIP it. If you cannot download from nuget.org then there's nothing we can do, this is a critical piece of package publishing that we assume all users have access to.

@yangjieshao
Copy link
Author

Thank you
I find that the reason why I can't find the file is that the default platform is ARM
After I changed it to x64 ,Sample program can run
But there still some question

on the TestReceiveAV
I don't have an SSL certificate,So I commented out the code
Snipaste_2020-03-30_20-53-40
Then I start the program
When I start the camera on th web, Th program crash
Snipaste_2020-03-30_20-52-58
Snipaste_2020-03-30_20-51-53

So I try to run TestNetCoreConsole
It crash at "await pc.InitializeAsync(config);"
22  Snipaste_2020-03-30_20-56-07

In case because I can't connect to goole, I removed the configuration of Google's iceserver
Snipaste_2020-03-30_21-07-58
But it's still crash

@yangjieshao
Copy link
Author

yangjieshao commented Mar 30, 2020

Snipaste_2020-03-30_21-16-13
Snipaste_2020-03-30_21-17-06
Snipaste_2020-03-30_21-17-21
Snipaste_2020-03-30_21-28-32

@yangjieshao
Copy link
Author

yangjieshao commented Mar 30, 2020

I found TestReceiveAV is default

<PackageReference Include="Microsoft.MixedReality.WebRTC" Version="1.0.2" />

so I changed it to

 <ProjectReference Include="..\..\libs\Microsoft.MixedReality.WebRTC\Microsoft.MixedReality.WebRTC.csproj" />

then copy Microsoft.MixedReality.WebRTC.dll and Microsoft.MixedReality.WebRTC.Native.dll to TestReceiveAV\bin\Debug

change
session.pc.AddIceCandidate((string)jsonMsg["sdpMLineindex"], (int)jsonMsg["sdpMid"], (string)jsonMsg["candidate"]);
to
session.pc.AddIceCandidate((string)jsonMsg["sdpMid"], (int)jsonMsg["sdpMLineindex"], (string)jsonMsg["candidate"]);at line 85

then I run the program
when I start the webcamera
Snipaste_2020-03-30_22-00-23
Snipaste_2020-03-30_22-00-39
Snipaste_2020-03-30_22-00-49
Snipaste_2020-03-30_22-19-47

@djee-ms
Copy link
Member

djee-ms commented Mar 30, 2020

You have an audio capture device (webcam, laptop microphone, ...) that doesn't work with Windows Core Audio. The Google implementation of the Audio Device Module (ADM; this is the adm() assert you have) requires that ALL devices that capture audio work. This is a known "limitation" (bug) of the Google implementation. See for example #140 and #141, and the Google bug. You need to find which device it is and remove it (if USB) or disable it via the device manager (if built-in). At the moment this is the only workaround.

For the TestReceiveAV dependency on 1.0.2 we should probably fix it, thanks for the feedback!

@djee-ms
Copy link
Member

djee-ms commented Mar 30, 2020

I logged #242 so we can fix or workaround that Core Audio issue, which is causing so much pain to many users.

@djee-ms
Copy link
Member

djee-ms commented Mar 30, 2020

Note also, as you already noticed, that the Google STUN server is a default value but you can replace it, and you can also not use any STUN server if you don't need NAT traversal (for example during testing on local LAN network or on the same machine).

@yangjieshao
Copy link
Author

thank you
I think I found the device
It's a microphone interface extended by USB
Maybe it's not good for USB expansion device support

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need info More information is needed from the author to answer
Projects
None yet
Development

No branches or pull requests

2 participants