Skip to content

Commit

Permalink
Fix type not compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
feast107 committed Nov 11, 2024
1 parent 3c8f8e4 commit 8e7391d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Antelcat.MediasoupSharp/DirectTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DirectTransportConstructorOptions<TDirectTransportAppData>(Transpor
Interfaces = [typeof(ITransport)],
Exclude = [nameof(ProduceAsync)])]
public class DirectTransportImpl<TDirectTransportAppData>
: Transport<
: TransportImpl<
TDirectTransportAppData,
DirectTransportEvents,
DirectTransportObserver
Expand Down
2 changes: 1 addition & 1 deletion src/Antelcat.MediasoupSharp/PipeTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public partial class PipeTransportData(DumpT dump) : TransportBaseData(dump)
Interfaces = [typeof(ITransport), typeof(IEnhancedEventEmitter<PipeTransportObserver>)],
Exclude = [nameof(ConsumeAsync)])]
public class PipeTransportImpl<TPipeTransportAppData>
: Transport<
: TransportImpl<
TPipeTransportAppData,
PipeTransportEvents,
PipeTransportObserver
Expand Down
2 changes: 1 addition & 1 deletion src/Antelcat.MediasoupSharp/PlainTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public partial class PlainTransportData(DumpT dump) : TransportBaseData(dump)
NamingTemplate = nameof(IPlainTransport),
Interfaces = [typeof(ITransport), typeof(IEnhancedEventEmitter<PlainTransportEvents>)])]
public class PlainTransportImpl<TPlainTransportAppData>
: Transport<
: TransportImpl<
TPlainTransportAppData,
PlainTransportEvents,
PlainTransportObserver
Expand Down
15 changes: 8 additions & 7 deletions src/Antelcat.MediasoupSharp/Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,47 +677,48 @@ public async Task<DirectTransportImpl<TDirectTransportAppData>> CreateDirectTran

private async Task ConfigureTransportAsync(ITransport transport, IWebRtcServer? webRtcServer = null)
{
var trans = (transport as IEnhancedEventEmitter<TransportEvents>).NotNull();
await using (await transportsLock.WriteLockAsync())
{
transports[transport.Id] = transport;
}

transport.On(static x => x.close, async _ =>
trans.On(static x => x.close, async _ =>
{
await using (await transportsLock.WriteLockAsync())
{
transports.Remove(transport.Id);
}
});
transport.On(static x => x.listenServerClose, async _ =>
trans.On(static x => x.listenServerClose, async _ =>
{
await using (await transportsLock.WriteLockAsync())
{
transports.Remove(transport.Id);
}
});
transport.On(static x => x.newProducer, async producer =>
trans.On(static x => x.newProducer, async producer =>
{
await using (await producersLock.WriteLockAsync())
{
producers[producer.Id] = producer;
}
});
transport.On(static x => x.producerClose, async producer =>
trans.On(static x => x.producerClose, async producer =>
{
await using (await producersLock.WriteLockAsync())
{
producers.Remove(producer.Id);
}
});
transport.On(static x => x.newDataProducer, async dataProducer =>
trans.On(static x => x.newDataProducer, async dataProducer =>
{
await using (await dataProducersLock.WriteLockAsync())
{
dataProducers[dataProducer.Id] = dataProducer;
}
});
transport.On(static x => x.dataProducerClose, async dataProducer =>
trans.On(static x => x.dataProducerClose, async dataProducer =>
{
await using (await dataProducersLock.WriteLockAsync())
{
Expand Down Expand Up @@ -1242,7 +1243,7 @@ private async Task CloseInternalAsync()
private Task ConfigureRtpObserverAsync(IRtpObserver rtpObserver)
{
rtpObservers[rtpObserver.Internal.RtpObserverId] = rtpObserver;
rtpObserver.On(static x => x.close, async _ =>
(rtpObserver as IEnhancedEventEmitter<RtpObserverEvents>)?.On(static x => x.close, async _ =>
{
await using (await rtpObserversLock.WriteLockAsync())
{
Expand Down
4 changes: 2 additions & 2 deletions src/Antelcat.MediasoupSharp/RtpObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace Antelcat.MediasoupSharp;

[AutoExtractInterface(
NamingTemplate = nameof(IRtpObserver),
Interfaces = [typeof(IEnhancedEventEmitter<RtpObserverEvents>)])
NamingTemplate = nameof(IRtpObserver)
)
]
public abstract class RtpObserverImpl<TRtpObserverAppData, TEvents, TObserver>
: EnhancedEventEmitter<TEvents>,
Expand Down
6 changes: 3 additions & 3 deletions src/Antelcat.MediasoupSharp/Transport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public partial class TransportBaseData
public SctpState? SctpState { get; set; }
}

[AutoExtractInterface(Interfaces = [typeof(IEnhancedEventEmitter<TransportEvents>)])]
public abstract class Transport<TTransportAppData, TEvents, TObserver>
[AutoExtractInterface(NamingTemplate = nameof(ITransport))]
public abstract class TransportImpl<TTransportAppData, TEvents, TObserver>
: EnhancedEventEmitter<TEvents>,
ITransport<
TTransportAppData,
Expand Down Expand Up @@ -216,7 +216,7 @@ public abstract class Transport<TTransportAppData, TEvents, TObserver>
/// <para>@emits <see cref="TransportObserverEvents.NewDataProducer"/> - (dataProducer: DataProducer)</para>
/// <para>@emits <see cref="TransportObserverEvents.NewDataConsumer"/> - (dataProducer: DataProducer)</para>
/// </summary>
protected Transport(TransportConstructorOptions<TTransportAppData> options, TObserver observer)
protected TransportImpl(TransportConstructorOptions<TTransportAppData> options, TObserver observer)
{
Internal = options.Internal;
Data = options.Data;
Expand Down
1 change: 0 additions & 1 deletion src/Antelcat.MediasoupSharp/TransportTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public interface ITransport<TTransportAppData, out TEvents, out TObserver>
where TEvents : TransportEvents
where TObserver : TransportObserver
{

TTransportAppData AppData { get; set; }
public TObserver Observer { get; }
}
2 changes: 1 addition & 1 deletion src/Antelcat.MediasoupSharp/WebRtcTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class WebRtcTransportConstructorOptions<TWebRtcTransportAppData>(WebRtcTr
NamingTemplate = nameof(IWebRtcTransport),
Interfaces = [typeof(ITransport), typeof(IEnhancedEventEmitter<WebRtcTransportEvents>)])]
public class WebRtcTransportImpl<TWebRtcTransportAppData> :
Transport<
TransportImpl<
TWebRtcTransportAppData,
WebRtcTransportEvents,
WebRtcTransportObserver
Expand Down

0 comments on commit 8e7391d

Please sign in to comment.