BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
694 stars 284 forks source link

If the payload format numbers for video and audio in a stream are the same, the video will not recive. #139

Open vincentiger opened 1 month ago

vincentiger commented 1 month ago

Bug Description

When the payload format numbers for video and audio in a stream are the same, the video does not display.

Steps to Reproduce

  1. Ensure that the payload format numbers for both video and audio in a stream are set to the same value.
  2. Attempt to display the video stream.

Expected Behavior

The video stream should display correctly, regardless of the payload format numbers.

Actual Behavior

The video stream does not display when the payload format numbers for video and audio are the same.

Workaround

To focus on receiving only the video stream, I use the following code:


while (!string.IsNullOrEmpty(line = sdpStreamReader.ReadLine()))
{
    if (line[0] == 'm')
    {
        ParseMediaLine(line);
    }
    else if (line[0] == 'a')
    {
        ParseAttributesLine(line);
    }

    if (line.Contains("track1"))
    {
        break;
    }
}

The loop stops reading lines once it encounters a line containing "track1", focusing the parsing process on the relevant video stream data.