sipsorcery
sipsorcery copied to clipboard
Softphone Render Video frame
Hi,
I have an intercom device that communicates with a Softphone SIP (WPF). I have set up a MediaSession using the following code: https://github.com/ntdgo/Intercom-Video
private VoIPMediaSession CreateMediaSessionAsync()
{
var windowsAudioEndPoint = new WindowsAudioEndPoint(new AudioEncoder(), -1, -1);
var testPattern = new VideoTestPatternSource(new VpxVideoEncoder());
var vp8VideoSink = new VideoEncoderEndPoint();
var mediaEndPoints = new MediaEndPoints
{
AudioSink = windowsAudioEndPoint,
AudioSource = windowsAudioEndPoint,
VideoSink = vp8VideoSink,
VideoSource = testPattern,
};
var voipMediaSession = new VoIPMediaSession(mediaEndPoints);
voipMediaSession.AcceptRtpFromAny = true;
voipMediaSession.OnRtpPacketReceived += VoipMediaSession_OnRtpPacketReceived;
return voipMediaSession;
}
private void VoipMediaSession_OnRtpPacketReceived(IPEndPoint remoteEndPoint, SDPMediaTypesEnum mediaType, RTPPacket rtpPacket)
{
if (mediaType == SDPMediaTypesEnum.video)
{
// Do something with the video RTP packets to display the video.
}
}
Could someone please guide me on how to render rtpPacket as a WPF image or video to display on the UI?
Thank you!