Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ It contains **no implementation details** — only term definitions.
## Terms

### Host
A peer that initiates a WebRTC session by opening a TCP listener and waiting for
an incoming connection before creating an SDP offer.
The API root object used as the non-browser equivalent of `Navigator`, including
access to `MediaDevices`.

### Guest
A peer that joins a WebRTC session by dialling the Host's IP address and port,
then responding to the Host's SDP offer with an SDP answer.
### Caller
A peer that initiates a WebRTC session by creating and sending the SDP offer.

### Callee
A peer that receives the SDP offer and responds with an SDP answer.

### Signaling
The out-of-band exchange of SDP offers/answers and ICE candidates between two
Expand All @@ -32,3 +34,13 @@ a direct TCP signaling channel, targeting both .NET 10 and .NET Framework 4.8.
A prototype `VideoRenderer` implementation backed by a WPF `WriteableBitmap`.
Lives in `examples/BasicVideoChat` until a proper `WebRtcNet.Wpf` renderer
assembly is created (see issue #36).

## Relationships

- **Host** exposes **MediaDevices** as the API entry point for capture access.
- A **Caller** sends an SDP offer and a **Callee** returns an SDP answer.

## Flagged ambiguities

- "Host" previously meant the signaling initiator peer; resolved to the API root
object. Signaling roles are now **Caller** and **Callee**.
26 changes: 26 additions & 0 deletions WebRtcInterop/Media/MediaDevices.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "pch.h"

#include "MediaDevices.h"

using namespace System::Collections::Generic;
using namespace System::Threading::Tasks;

namespace WebRtcInterop::Media
{
Task<IEnumerable<WebRtcNet::Media::MediaDeviceInfo^>^>^ MediaDevices::EnumerateDevices()
{
auto devices = gcnew List<WebRtcNet::Media::MediaDeviceInfo^>();
return Task::FromResult<IEnumerable<WebRtcNet::Media::MediaDeviceInfo^>^>(devices);
}

WebRtcNet::Media::MediaTrackSupportedConstraints^ MediaDevices::GetSupportedConstraints()
{
return gcnew WebRtcNet::Media::MediaTrackSupportedConstraints();
}

Task<WebRtcNet::Media::MediaStream^>^ MediaDevices::GetUserMedia(WebRtcNet::Media::MediaStreamConstraints^ constraints)
{
return Task::FromException<WebRtcNet::Media::MediaStream^>(
gcnew WebRtcNet::Media::MediaStreamException("GetUserMedia is not currently implemented."));
}
}
25 changes: 25 additions & 0 deletions WebRtcInterop/Media/MediaDevices.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

namespace WebRtcInterop::Media
{
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Threading::Tasks;

public ref class MediaDevices : WebRtcNet::Media::MediaDevices
{
public:
virtual event EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ OnDeviceChange
{
void add(EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ value) override { on_device_change_ += value; }
void remove(EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ value) override { on_device_change_ -= value; }
}

virtual Task<IEnumerable<WebRtcNet::Media::MediaDeviceInfo^>^>^ EnumerateDevices() override;
virtual WebRtcNet::Media::MediaTrackSupportedConstraints^ GetSupportedConstraints() override;
virtual Task<WebRtcNet::Media::MediaStream^>^ GetUserMedia(WebRtcNet::Media::MediaStreamConstraints^ constraints) override;

private:
EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ on_device_change_;
};
}
12 changes: 12 additions & 0 deletions WebRtcInterop/Media/MediaDevicesFactory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "pch.h"

#include "MediaDevicesFactory.h"
#include "MediaDevices.h"

namespace WebRtcInterop::Media
{
WebRtcNet::Media::MediaDevices^ MediaDevicesFactory::CreateMediaDevices()
{
return gcnew MediaDevices();
}
}
10 changes: 10 additions & 0 deletions WebRtcInterop/Media/MediaDevicesFactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace WebRtcInterop::Media
{
public ref class MediaDevicesFactory sealed
{
public:
static WebRtcNet::Media::MediaDevices^ CreateMediaDevices();
};
}
17 changes: 0 additions & 17 deletions WebRtcInterop/Media/MediaStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ using namespace WebRtcNet;

namespace WebRtcInterop::Media
{
Task<IEnumerable<MediaDeviceInfo^>^>^ MediaDevices::EnumerateDevices()
{
auto devices = gcnew List<MediaDeviceInfo^>();
return Task::FromResult<IEnumerable<MediaDeviceInfo^>^>(devices);
}

MediaTrackSupportedConstraints^ MediaDevices::GetSupportedConstraints()
{
return gcnew MediaTrackSupportedConstraints();
}

Task<WebRtcNet::Media::MediaStream^>^ MediaDevices::GetUserMedia(MediaStreamConstraints^ constraints)
{
return Task::FromException<WebRtcNet::Media::MediaStream^>(
gcnew MediaStreamException("GetUserMedia is not currently implemented."));
}

MediaStream::MediaStream(WebRtcNet::Media::MediaStream^ stream)
: _rpMediaStreamInterface(nullptr),
on_active_(nullptr),
Expand Down
16 changes: 0 additions & 16 deletions WebRtcInterop/Media/MediaStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,4 @@ namespace WebRtcInterop::Media
EventHandler<WebRtcNet::Media::MediaStreamTrack^>^ on_remove_track_;
};

public ref class MediaDevices : WebRtcNet::Media::MediaDevices
{
public:
virtual event EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ OnDeviceChange
{
void add(EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ value) { on_device_change_ += value; }
void remove(EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ value) { on_device_change_ -= value; }
}

virtual Task<IEnumerable<WebRtcNet::Media::MediaDeviceInfo^>^>^ EnumerateDevices();
virtual WebRtcNet::Media::MediaTrackSupportedConstraints^ GetSupportedConstraints();
virtual Task<WebRtcNet::Media::MediaStream^>^ GetUserMedia(WebRtcNet::Media::MediaStreamConstraints^ constraints);

private:
EventHandler<WebRtcNet::Media::DeviceChangeEventArgs^>^ on_device_change_;
};
}
Loading
Loading