2626using Serilog . Extensions . Logging ;
2727using SIPSorcery . Media ;
2828using SIPSorcery . Net ;
29+ using SIPSorceryMedia . Abstractions ;
2930using SIPSorceryMedia . Encoders ;
3031using SIPSorceryMedia . FFmpeg ;
3132using SIPSorceryMedia . Windows ;
33+ using Vpx . Net ;
3234using WebSocketSharp . Server ;
3335
3436namespace demo
3537{
3638 class Program
3739 {
40+ private const string LINUX_FFMPEG_LIB_PATH = "/usr/local/lib/" ;
41+
3842 private const int WEBSOCKET_PORT = 8081 ;
3943 private const string STUN_URL = "stun:stun.sipsorcery.com" ;
4044 //private const string WEBCAM_NAME = "Logitech QuickCam Pro 9000";
@@ -45,7 +49,6 @@ class Program
4549 static void Main ( )
4650 {
4751 Console . WriteLine ( "WebRTC Webcam Send Demo" ) ;
48- Console . WriteLine ( "Press ctrl-c to exit." ) ;
4952
5053 logger = AddConsoleLogger ( ) ;
5154
@@ -65,6 +68,16 @@ static void Main()
6568 //}
6669 //await winVideoEP.StartVideo();
6770
71+ if ( Environment . OSVersion . Platform == PlatformID . Unix )
72+ {
73+ FFmpegInit . Initialise ( FfmpegLogLevelEnum . AV_LOG_VERBOSE , LINUX_FFMPEG_LIB_PATH , logger ) ;
74+ }
75+ else
76+ {
77+ FFmpegInit . Initialise ( FfmpegLogLevelEnum . AV_LOG_VERBOSE , null , logger ) ;
78+ }
79+
80+
6881 // Start web socket.
6982 Console . WriteLine ( "Starting web socket server..." ) ;
7083 var webSocketServer = new WebSocketServer ( IPAddress . Any , WEBSOCKET_PORT ) ;
@@ -94,12 +107,14 @@ private static async Task<RTCPeerConnection> CreatePeerConnection()
94107 } ;
95108 var pc = new RTCPeerConnection ( config ) ;
96109
97- WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint ( new VpxVideoEncoder ( ) , WEBCAM_NAME ) ;
110+ //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new VP8Codec(), WEBCAM_NAME);
111+ //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new VP8Codec(), WEBCAM_NAME, 960, 720, 30);
112+ //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new VpxVideoEncoder(), WEBCAM_NAME);
113+ //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new VpxVideoEncoder(), WEBCAM_NAME, 1920, 1080, 30);
98114 //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(new FFmpegVideoEncoder(), WEBCAM_NAME);
115+ WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint ( new FFmpegVideoEncoder ( ) , WEBCAM_NAME , 1920 , 1080 , 30 ) ;
99116 //WindowsVideoEndPoint winVideoEP = new WindowsVideoEndPoint(WEBCAM_NAME, 1920, 1080, 30);
100- //winVideoEP.RestrictFormats(x => x.Codec == SIPSorceryMedia.Abstractions.V1.VideoCodecsEnum.H264);
101-
102-
117+ winVideoEP . RestrictFormats ( x => x . Codec == VideoCodecsEnum . H264 ) ;
103118
104119 bool initResult = await winVideoEP . InitialiseVideoSourceDevice ( ) ;
105120 if ( ! initResult )
0 commit comments