在使用SIPSorcery时,以下语句始终报错:
WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new VpxVideoEncoder(), WEBCAM_NAME);
折腾了一晚上,终于弄明白了。
SIPSorceryMedia.Encoders实现的SIPSorceryMedia.Abstractions中定义的接口,它最高只能使用Abstractions 1.1.0,因为1.2.0中多定义了个EncodeVideoFaster方法,项目中使用的Encoders并没有实现此方法。而项目中使用的Abstractions 1.2.0是由SIPSorcery中引入进来的。
解决办法:对SIPSorcery和SIPSorceryMedia.Windows降级,不能使用最新版本。
目前最高版本搭配为:
<PackageReference Include="SIPSorcery" Version="6.0.6" />
<PackageReference Include="SIPSorceryMedia.Encoders" Version="0.0.10-pre" />
<PackageReference Include="SIPSorceryMedia.Windows" Version="6.0.1-pre" />