sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.44k stars 438 forks source link

Softphone Render Video frame #1128

Closed ntdgo closed 1 month ago

ntdgo commented 3 months ago

Hi,

image

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!

hossam14102010 commented 3 months ago

does #983 help you?

hossam14102010 commented 2 months ago

#1137

ChristopheI commented 1 month ago

I guess you have all necessary information. I close the issue. Re-open it if necessary