Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rogurotus committed Oct 11, 2023
1 parent af40b12 commit bb1a3c0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ class VideoTrackProxy(private val track: MediaStreamTrackProxy) {
* Adds every [SurfaceTextureRenderer] from the [sinks] to the updater underlying [WVideoTrack].
*/
private fun renewSinks() {
// sinks.forEach { getVideoTrack().addSink(it) }
sinks.forEach { getVideoTrack().addSink(it) }
}
}
3 changes: 0 additions & 3 deletions crates/libwebrtc-sys/src/cpp/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "pc/proxy.h"
#include "test_audio_device_module.cc"

#include <iostream>

namespace bridge {

// Creates a new `TrackEventObserver`.
Expand Down Expand Up @@ -452,7 +450,6 @@ TrackState audio_track_state(const AudioTrackInterface& track) {
// Used to connect the given `track` to the underlying video engine.
void add_or_update_video_sink(const VideoTrackInterface& track,
VideoSinkInterface& sink) {
std::cout << "ADD SINk " << std::endl;
track->AddOrUpdateSink(&sink, rtc::VideoSinkWants());
}

Expand Down
1 change: 0 additions & 1 deletion crates/libwebrtc-sys/src/cpp/video_sink.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "libwebrtc-sys/include/video_sink.h"
#include "libwebrtc-sys/src/bridge.rs.h"
#include <iostream>

namespace video_sink {

Expand Down
1 change: 0 additions & 1 deletion crates/libwebrtc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,6 @@ impl VideoTrackInterface {
/// Used to connect this [`VideoTrackInterface`] to the underlying video
/// engine.
pub fn add_or_update_sink(&self, sink: &mut VideoSinkInterface) {
println!("ADD");
webrtc::add_or_update_video_sink(&self.inner, sink.0.pin_mut());
}

Expand Down
18 changes: 12 additions & 6 deletions crates/native/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,11 @@ pub fn track_state(
WEBRTC.lock().unwrap().track_state(track_id, kind)
}

// todo
/// Returns the [height][0] property of the media track by its ID and
/// media type.
/// Blocks until height is initialized.
///
/// [0]: https://www.w3.org/TR/mediacapture-streams/#dfn-height
pub fn track_height(
track_id: String,
kind: MediaType,
Expand All @@ -2193,11 +2197,14 @@ pub fn track_height(
return Ok(None);
}

let res = WEBRTC.lock().unwrap().track_height(track_id).map(Some);
res
WEBRTC.lock().unwrap().track_height(track_id).map(Some)
}

// todo
/// Returns the [width][0] property of the media track by its ID and
/// media type.
/// Blocks until width is initialized.
///
/// [0]: https://www.w3.org/TR/mediacapture-streams/#dfn-height
pub fn track_width(
track_id: String,
kind: MediaType,
Expand All @@ -2206,8 +2213,7 @@ pub fn track_width(
return Ok(None);
}

let res = WEBRTC.lock().unwrap().track_width(track_id).map(Some);
res
WEBRTC.lock().unwrap().track_width(track_id).map(Some)
}

/// Changes the [enabled][1] property of the [`MediaStreamTrack`] by its ID and
Expand Down
2 changes: 1 addition & 1 deletion crates/native/src/user_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl Webrtc {

/// Returns the [height][0] property of the media track by its ID and
/// media type.
/// Blocks until width is initialized.
/// Blocks until height is initialized.
///
/// [0]: https://www.w3.org/TR/mediacapture-streams/#dfn-height
pub fn track_height(&self, id: String) -> anyhow::Result<i32> {
Expand Down
6 changes: 0 additions & 6 deletions example/lib/src/get_user_media.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,15 @@ class _GetUserMediaSampleState extends State<GetUserMediaSample> {
caps.audio.mandatory!.deviceId = audioInputDevice;

caps.video.mandatory = DeviceVideoConstraints();
caps.video.optional = DeviceVideoConstraints();
caps.video.mandatory!.deviceId = videoInputDevice;
caps.video.mandatory!.width = 1920;
caps.video.mandatory!.height = 1080;
// caps.video.optional!.width = 200;
// caps.video.optional!.height = 200;
caps.video.mandatory!.fps = 30;

try {
var stream = await getUserMedia(caps);
_mediaDevicesList = await enumerateDevices();
_tracks = stream;
for (var i in _tracks!) {
print("W - ${await i.width()} H - ${await i.height()}");
}
await _localRenderer.setSrcObject(_tracks!.firstWhere((track) {
return track.kind() == MediaKind.video;
}));
Expand Down
1 change: 0 additions & 1 deletion example/lib/src/loopback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class _LoopbackState extends State<Loopback> {
try {
_mediaDevicesList = await enumerateDevices();
_tracks = await getUserMedia(caps);

await _localRenderer.setSrcObject(
_tracks!.firstWhere((track) => track.kind() == MediaKind.video));

Expand Down

0 comments on commit bb1a3c0

Please sign in to comment.