Skip to content

Commit

Permalink
update to use re-export
Browse files Browse the repository at this point in the history
  • Loading branch information
wdv4758h committed Oct 25, 2021
1 parent 69e90ae commit 7da1d57
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 65 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ repository = "https://github.com/webrtc-rs/examples"


[dev-dependencies]
webrtc = { git = "https://github.com/wdv4758h/webrtc/", branch = "re-export" }
util = { package = "webrtc-util", version = "0.5.0" }
rtp = "0.6.0"
rtcp = "0.5.0"
data = { package = "webrtc-data", version = "0.3.0" }
interceptor = "0.4.0"
media = { package = "webrtc-media", version = "0.4.0" }
webrtc = "0.2.1" #{ path = "..", version = "0.2.1" } #
tokio = { version = "1.12.0", features = ["full"] }
env_logger = "0.9.0"
clap = "2"
Expand Down
4 changes: 2 additions & 2 deletions examples/broadcast/broadcast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::io::Write;
use std::sync::Arc;
use tokio::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion examples/data-channels-close/data-channels-close.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::atomic::{AtomicI32, Ordering};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion examples/data-channels-create/data-channels-create.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::Arc;
use tokio::time::Duration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use bytes::Bytes;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::Arc;
use tokio::time::Duration;
Expand Down Expand Up @@ -197,7 +197,7 @@ async fn main() -> Result<()> {
}

// read_loop shows how to read from the datachannel directly
async fn read_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
async fn read_loop(d: Arc<webrtc::webrtc_data::data_channel::DataChannel>) -> Result<()> {
let mut buffer = vec![0u8; MESSAGE_SIZE];
loop {
let n = match d.read(&mut buffer).await {
Expand All @@ -216,7 +216,7 @@ async fn read_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
}

// write_loop shows how to write to the datachannel directly
async fn write_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
async fn write_loop(d: Arc<webrtc::webrtc_data::data_channel::DataChannel>) -> Result<()> {
let mut result = Result::<usize>::Ok(0);
while result.is_ok() {
let timeout = tokio::time::sleep(Duration::from_secs(5));
Expand Down
6 changes: 3 additions & 3 deletions examples/data-channels-detach/data-channels-detach.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use bytes::Bytes;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::Arc;
use tokio::time::Duration;
Expand Down Expand Up @@ -206,7 +206,7 @@ async fn main() -> Result<()> {
}

// read_loop shows how to read from the datachannel directly
async fn read_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
async fn read_loop(d: Arc<webrtc::webrtc_data::data_channel::DataChannel>) -> Result<()> {
let mut buffer = vec![0u8; MESSAGE_SIZE];
loop {
let n = match d.read(&mut buffer).await {
Expand All @@ -225,7 +225,7 @@ async fn read_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
}

// write_loop shows how to write to the datachannel directly
async fn write_loop(d: Arc<data::data_channel::DataChannel>) -> Result<()> {
async fn write_loop(d: Arc<webrtc::webrtc_data::data_channel::DataChannel>) -> Result<()> {
let mut result = Result::<usize>::Ok(0);
while result.is_ok() {
let timeout = tokio::time::sleep(Duration::from_secs(5));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use bytes::Bytes;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion examples/data-channels/data-channels.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::Arc;
use tokio::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion examples/ice-restart/ice-restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use clap::{App, AppSettings, Arg};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::net::SocketAddr;
use std::str::FromStr;
Expand Down
6 changes: 3 additions & 3 deletions examples/insertable-streams/insertable-streams.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::ivf_reader::IVFReader;
use media::Sample;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::ivf_reader::IVFReader;
use webrtc::webrtc_media::Sample;
use std::fs::File;
use std::io::BufReader;
use std::io::Write;
Expand Down
2 changes: 1 addition & 1 deletion examples/offer-answer/answer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use clap::{App, AppSettings, Arg};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Client, Method, Request, Response, Server, StatusCode};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::net::SocketAddr;
use std::str::FromStr;
Expand Down
2 changes: 1 addition & 1 deletion examples/offer-answer/offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use clap::{App, AppSettings, Arg};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Client, Method, Request, Response, Server, StatusCode};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::net::SocketAddr;
use std::str::FromStr;
Expand Down
8 changes: 4 additions & 4 deletions examples/play-from-disk-h264/play-from-disk-h264.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::h264_reader::H264Reader;
use media::io::ogg_reader::OggReader;
use media::Sample;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::h264_reader::H264Reader;
use webrtc::webrtc_media::io::ogg_reader::OggReader;
use webrtc::webrtc_media::Sample;
use std::fs::File;
use std::io::BufReader;
use std::io::Write;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use anyhow::Result;
use clap::{App, AppSettings, Arg};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use interceptor::registry::Registry;
use media::io::ivf_reader::IVFReader;
use media::Sample;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::ivf_reader::IVFReader;
use webrtc::webrtc_media::Sample;
use std::fs::File;
use std::io::BufReader;
use std::io::Write;
Expand Down
8 changes: 4 additions & 4 deletions examples/play-from-disk-vp8/play-from-disk-vp8.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::ivf_reader::IVFReader;
use media::io::ogg_reader::OggReader;
use media::Sample;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::ivf_reader::IVFReader;
use webrtc::webrtc_media::io::ogg_reader::OggReader;
use webrtc::webrtc_media::Sample;
use std::fs::File;
use std::io::BufReader;
use std::io::Write;
Expand Down
8 changes: 4 additions & 4 deletions examples/play-from-disk-vp9/play-from-disk-vp9.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::ivf_reader::IVFReader;
use media::io::ogg_reader::OggReader;
use media::Sample;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::ivf_reader::IVFReader;
use webrtc::webrtc_media::io::ogg_reader::OggReader;
use webrtc::webrtc_media::Sample;
use std::fs::File;
use std::io::BufReader;
use std::io::Write;
Expand Down
4 changes: 2 additions & 2 deletions examples/reflect/reflect.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::collections::HashMap;
use std::io::Write;
use std::sync::Arc;
Expand Down
6 changes: 3 additions & 3 deletions examples/rtp-forwarder/rtp-forwarder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::collections::HashMap;
use std::io::Write;
use std::sync::Arc;
Expand Down Expand Up @@ -213,7 +213,7 @@ async fn main() -> Result<()> {
while let Ok((n, _)) = track.read(&mut b).await {
// Unmarshal the packet and update the PayloadType
let mut buf = &b[..n];
let mut rtp_packet = rtp::packet::Packet::unmarshal(&mut buf)?;
let mut rtp_packet = webrtc::rtp::packet::Packet::unmarshal(&mut buf)?;
rtp_packet.header.payload_type = c.payload_type;

// Marshal into original buffer with updated PayloadType
Expand Down
2 changes: 1 addition & 1 deletion examples/rtp-to-webrtc/rtp-to-webrtc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use webrtc::interceptor::registry::Registry;
use std::io::Write;
use std::sync::Arc;
use tokio::net::UdpSocket;
Expand Down
14 changes: 7 additions & 7 deletions examples/save-to-disk-h264/save-to-disk-h264.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::h264_writer::H264Writer;
use media::io::ogg_writer::OggWriter;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::h264_writer::H264Writer;
use webrtc::webrtc_media::io::ogg_writer::OggWriter;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::fs::File;
use std::io::Write;
use std::sync::Arc;
Expand All @@ -21,7 +21,7 @@ use webrtc::peer::ice::ice_server::RTCIceServer;
use webrtc::peer::sdp::session_description::RTCSessionDescription;

async fn save_to_disk(
writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>>,
writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>>,
track: Arc<TrackRemote>,
notify: Arc<Notify>,
) -> Result<()> {
Expand Down Expand Up @@ -118,9 +118,9 @@ async fn main() -> Result<()> {
let video_file = matches.value_of("video").unwrap();
let audio_file = matches.value_of("audio").unwrap();

let h264_writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>> =
let h264_writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>> =
Arc::new(Mutex::new(H264Writer::new(File::create(video_file)?)));
let ogg_writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>> = Arc::new(Mutex::new(
let ogg_writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>> = Arc::new(Mutex::new(
OggWriter::new(File::create(audio_file)?, 48000, 2)?,
));

Expand Down
16 changes: 8 additions & 8 deletions examples/save-to-disk-vpx/save-to-disk-vpx.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use media::io::ivf_reader::IVFFileHeader;
use media::io::ivf_writer::IVFWriter;
use media::io::ogg_writer::OggWriter;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::webrtc_media::io::ivf_reader::IVFFileHeader;
use webrtc::webrtc_media::io::ivf_writer::IVFWriter;
use webrtc::webrtc_media::io::ogg_writer::OggWriter;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::fs::File;
use std::io::Write;
use std::sync::Arc;
Expand All @@ -22,7 +22,7 @@ use webrtc::peer::ice::ice_server::RTCIceServer;
use webrtc::peer::sdp::session_description::RTCSessionDescription;

async fn save_to_disk(
writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>>,
writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>>,
track: Arc<TrackRemote>,
notify: Arc<Notify>,
) -> Result<()> {
Expand Down Expand Up @@ -125,7 +125,7 @@ async fn main() -> Result<()> {
let video_file = matches.value_of("video").unwrap();
let audio_file = matches.value_of("audio").unwrap();

let ivf_writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>> =
let ivf_writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>> =
Arc::new(Mutex::new(IVFWriter::new(
File::create(video_file)?,
&IVFFileHeader {
Expand All @@ -141,7 +141,7 @@ async fn main() -> Result<()> {
unused: 0, // 28-31
},
)?));
let ogg_writer: Arc<Mutex<dyn media::io::Writer + Send + Sync>> = Arc::new(Mutex::new(
let ogg_writer: Arc<Mutex<dyn webrtc::webrtc_media::io::Writer + Send + Sync>> = Arc::new(Mutex::new(
OggWriter::new(File::create(audio_file)?, 48000, 2)?,
));

Expand Down
4 changes: 2 additions & 2 deletions examples/simulcast/simulcast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::collections::HashMap;
use std::io::Write;
use std::sync::Arc;
Expand Down
6 changes: 3 additions & 3 deletions examples/swap-tracks/swap-tracks.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg};
use interceptor::registry::Registry;
use rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use webrtc::interceptor::registry::Registry;
use webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication;
use std::io::Write;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::Arc;
Expand Down Expand Up @@ -136,7 +136,7 @@ async fn main() -> Result<()> {
// The total number of tracks
let track_count = Arc::new(AtomicUsize::new(0));
// The channel of packets with a bit of buffer
let (packets_tx, mut packets_rx) = tokio::sync::mpsc::channel::<rtp::packet::Packet>(60);
let (packets_tx, mut packets_rx) = tokio::sync::mpsc::channel::<webrtc::rtp::packet::Packet>(60);
let packets_tx = Arc::new(packets_tx);

// Set a handler for when a new remote track starts, this handler copies inbound RTP packets,
Expand Down

0 comments on commit 7da1d57

Please sign in to comment.