Skip to content

Commit beca7d2

Browse files
authored
refactor sending format (#1364)
1 parent 45caf6e commit beca7d2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/net/RTP/VideoStream.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class VideoStream : MediaStream
3232
protected static ILogger logger = Log.Logger;
3333
protected RtpVideoFramer RtpVideoFramer;
3434

35-
private SDPAudioVideoMediaFormat sendingFormat;
35+
private VideoFormat sendingFormat;
3636
private bool sendingFormatFound = false;
3737

3838
/// <summary>
@@ -304,28 +304,28 @@ public void SendVideo(uint durationRtpUnits, byte[] sample)
304304
{
305305
if (!sendingFormatFound)
306306
{
307-
sendingFormat = GetSendingFormat();
307+
sendingFormat = GetSendingFormat().ToVideoFormat();
308308
sendingFormatFound = true;
309309
}
310310

311-
int payloadID = Convert.ToInt32(sendingFormat.ID);
311+
int payloadID = sendingFormat.FormatID;
312312

313-
switch (sendingFormat.Name())
313+
switch (sendingFormat.Codec)
314314
{
315-
case "VP8":
315+
case VideoCodecsEnum.VP8:
316316
SendVp8Frame(durationRtpUnits, payloadID, sample);
317317
break;
318-
case "H264":
318+
case VideoCodecsEnum.H264:
319319
SendH264Frame(durationRtpUnits, payloadID, sample);
320320
break;
321-
case "H265":
321+
case VideoCodecsEnum.H265:
322322
SendH265Frame(durationRtpUnits, payloadID, sample);
323323
break;
324-
case "JPEG":
324+
case VideoCodecsEnum.JPEG:
325325
SendMJPEGFrame(durationRtpUnits, payloadID, sample);
326326
break;
327327
default:
328-
throw new ApplicationException($"Unsupported video format selected {sendingFormat.Name()}.");
328+
throw new ApplicationException($"Unsupported video format selected {sendingFormat.FormatName}.");
329329
}
330330
}
331331

0 commit comments

Comments
 (0)