feat: add publishing & audio to ffi (#46)

- Divide FFI protocol into multiple files
- Audio support
- AV Streams/Sources
- Create tracks
- Use Dashmap to store handles
- Add a capture test
     - Ignored by GHA atm
This commit is contained in:
Théo Monnom
2023-05-08 23:12:37 +02:00
committed by GitHub
parent a5caf12902
commit 1c12e749f2
58 changed files with 3046 additions and 1188 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ pub mod ffi {
fn create_rtc_configuration(conf: RTCConfiguration) -> UniquePtr<NativeRTCConfiguration>;
/// # Safety
/// The observer must live as long as the PeerConnection
/// The observer must live as long as the PeerConnection does
unsafe fn create_peer_connection(
self: &PeerConnectionFactory,
config: UniquePtr<NativeRTCConfiguration>,
+2 -2
View File
@@ -24,10 +24,10 @@ namespace livekit {
VideoFrame::VideoFrame(const webrtc::VideoFrame& frame)
: frame_(std::move(frame)) {}
int VideoFrame::width() const {
unsigned int VideoFrame::width() const {
return frame_.width();
}
int VideoFrame::height() const {
unsigned int VideoFrame::height() const {
return frame_.height();
}
uint32_t VideoFrame::size() const {
+2 -2
View File
@@ -22,8 +22,8 @@ pub mod ffi {
type VideoFrame;
fn width(self: &VideoFrame) -> i32;
fn height(self: &VideoFrame) -> i32;
fn width(self: &VideoFrame) -> u32;
fn height(self: &VideoFrame) -> u32;
fn size(self: &VideoFrame) -> u32;
fn id(self: &VideoFrame) -> u16;
fn timestamp_us(self: &VideoFrame) -> i64;
+12 -12
View File
@@ -26,11 +26,11 @@ VideoFrameBufferType VideoFrameBuffer::buffer_type() const {
return static_cast<VideoFrameBufferType>(buffer_->type());
}
int VideoFrameBuffer::width() const {
unsigned int VideoFrameBuffer::width() const {
return buffer_->width();
}
int VideoFrameBuffer::height() const {
unsigned int VideoFrameBuffer::height() const {
return buffer_->height();
}
@@ -83,23 +83,23 @@ PlanarYuvBuffer::PlanarYuvBuffer(
rtc::scoped_refptr<webrtc::PlanarYuvBuffer> buffer)
: VideoFrameBuffer(buffer) {}
int PlanarYuvBuffer::chroma_width() const {
unsigned int PlanarYuvBuffer::chroma_width() const {
return buffer()->ChromaWidth();
}
int PlanarYuvBuffer::chroma_height() const {
unsigned int PlanarYuvBuffer::chroma_height() const {
return buffer()->ChromaHeight();
}
int PlanarYuvBuffer::stride_y() const {
unsigned int PlanarYuvBuffer::stride_y() const {
return buffer()->StrideY();
}
int PlanarYuvBuffer::stride_u() const {
unsigned int PlanarYuvBuffer::stride_u() const {
return buffer()->StrideU();
}
int PlanarYuvBuffer::stride_v() const {
unsigned int PlanarYuvBuffer::stride_v() const {
return buffer()->StrideV();
}
@@ -151,19 +151,19 @@ BiplanarYuvBuffer::BiplanarYuvBuffer(
rtc::scoped_refptr<webrtc::BiplanarYuvBuffer> buffer)
: VideoFrameBuffer(buffer) {}
int BiplanarYuvBuffer::chroma_width() const {
unsigned int BiplanarYuvBuffer::chroma_width() const {
return buffer()->ChromaWidth();
}
int BiplanarYuvBuffer::chroma_height() const {
unsigned int BiplanarYuvBuffer::chroma_height() const {
return buffer()->ChromaHeight();
}
int BiplanarYuvBuffer::stride_y() const {
unsigned int BiplanarYuvBuffer::stride_y() const {
return buffer()->StrideY();
}
int BiplanarYuvBuffer::stride_uv() const {
unsigned int BiplanarYuvBuffer::stride_uv() const {
return buffer()->StrideUV();
}
@@ -204,7 +204,7 @@ I420ABuffer::I420ABuffer(
rtc::scoped_refptr<webrtc::I420ABufferInterface> buffer)
: I420Buffer(buffer) {}
int I420ABuffer::stride_a() const {
unsigned int I420ABuffer::stride_a() const {
return buffer()->StrideA();
}
+12 -12
View File
@@ -31,8 +31,8 @@ pub mod ffi {
type NV12Buffer;
fn buffer_type(self: &VideoFrameBuffer) -> VideoFrameBufferType;
fn width(self: &VideoFrameBuffer) -> i32;
fn height(self: &VideoFrameBuffer) -> i32;
fn width(self: &VideoFrameBuffer) -> u32;
fn height(self: &VideoFrameBuffer) -> u32;
/// # SAFETY
/// If the buffer type is I420, the buffer must be cloned before
@@ -47,11 +47,11 @@ pub mod ffi {
unsafe fn get_i010(self: Pin<&mut VideoFrameBuffer>) -> UniquePtr<I010Buffer>;
unsafe fn get_nv12(self: Pin<&mut VideoFrameBuffer>) -> UniquePtr<NV12Buffer>;
fn chroma_width(self: &PlanarYuvBuffer) -> i32;
fn chroma_height(self: &PlanarYuvBuffer) -> i32;
fn stride_y(self: &PlanarYuvBuffer) -> i32;
fn stride_u(self: &PlanarYuvBuffer) -> i32;
fn stride_v(self: &PlanarYuvBuffer) -> i32;
fn chroma_width(self: &PlanarYuvBuffer) -> u32;
fn chroma_height(self: &PlanarYuvBuffer) -> u32;
fn stride_y(self: &PlanarYuvBuffer) -> u32;
fn stride_u(self: &PlanarYuvBuffer) -> u32;
fn stride_v(self: &PlanarYuvBuffer) -> u32;
fn data_y(self: &PlanarYuv8Buffer) -> *const u8;
fn data_u(self: &PlanarYuv8Buffer) -> *const u8;
@@ -61,15 +61,15 @@ pub mod ffi {
fn data_u(self: &PlanarYuv16BBuffer) -> *const u16;
fn data_v(self: &PlanarYuv16BBuffer) -> *const u16;
fn chroma_width(self: &BiplanarYuvBuffer) -> i32;
fn chroma_height(self: &BiplanarYuvBuffer) -> i32;
fn stride_y(self: &BiplanarYuvBuffer) -> i32;
fn stride_uv(self: &BiplanarYuvBuffer) -> i32;
fn chroma_width(self: &BiplanarYuvBuffer) -> u32;
fn chroma_height(self: &BiplanarYuvBuffer) -> u32;
fn stride_y(self: &BiplanarYuvBuffer) -> u32;
fn stride_uv(self: &BiplanarYuvBuffer) -> u32;
fn data_y(self: &BiplanarYuv8Buffer) -> *const u8;
fn data_uv(self: &BiplanarYuv8Buffer) -> *const u8;
fn stride_a(self: &I420ABuffer) -> i32;
fn stride_a(self: &I420ABuffer) -> u32;
fn data_a(self: &I420ABuffer) -> *const u8;
fn new_i420_buffer(width: i32, height: i32) -> UniquePtr<I420Buffer>;