throw new ArgumentException("Audio is not configured with the current source.");
}
- WebRtc.ValidateWebRTCState(WebRTCState.Negotiating, WebRTCState.Playing);
-
NativeWebRTC.PushMediaPacket(WebRtc.Handle, SourceId.Value, packet.GetHandle()).
ThrowIfFailed("Failed to push the packet to the WebRTC");
}
{
if (mediaFormat == null)
{
- Log.Warn(WebRTCLog.Tag, "invalid media format");
+ return;
+ }
+
+ IntPtr ptr = IntPtr.Zero;
+
+ try
+ {
+ ptr = mediaFormat.AsNativeHandle();
+ NativeWebRTC.SetMediaPacketSourceInfo(WebRtc.Handle, SourceId.Value, ptr).
+ ThrowIfFailed("Failed to set the media stream info");
}
- else
+ finally
{
- IntPtr ptr = IntPtr.Zero;
-
- try
- {
- ptr = mediaFormat.AsNativeHandle();
- NativeWebRTC.SetMediaPacketSourceInfo(WebRtc.Handle, SourceId.Value, ptr).
- ThrowIfFailed("Failed to set the media stream info");
- }
- finally
- {
- MediaFormat.ReleaseNativeHandle(ptr);
- }
+ MediaFormat.ReleaseNativeHandle(ptr);
}
}