Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Updates to M87 #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 21, 2020
Merged

Updates to M87 #661

merged 8 commits into from
Nov 21, 2020

Conversation

geekuillaume
Copy link
Contributor

This updates the project to the last revision of libwebrtc. There is one fix needed before merging this: webrtc::DegradationPreference. I don't really understand why the conversion is not working anymore.

I also needed to migrate to RecursiveCriticalSection as it as replaced CriticalSection upstream.

The destructor test is still broken.

@markandrus
Copy link
Member

Awesome, @geekuillaume, thanks. Maybe I can help land this over the weekend.

@markandrus
Copy link
Member

See a little issue in AppVeyor, though:

  Traceback (most recent call last):
    File "C:/projects/node-webrtc-7bnua/build/external/libwebrtc/download/src/build/vs_toolchain.py", line 577, in <module>
      sys.exit(main())
    File "C:/projects/node-webrtc-7bnua/build/external/libwebrtc/download/src/build/vs_toolchain.py", line 573, in main
      return commands[sys.argv[1]](*sys.argv[2:])
    File "C:/projects/node-webrtc-7bnua/build/external/libwebrtc/download/src/build/vs_toolchain.py", line 388, in CopyDlls
      _CopyDebugger(target_dir, target_cpu)
    File "C:/projects/node-webrtc-7bnua/build/external/libwebrtc/download/src/build/vs_toolchain.py", line 424, in _CopyDebugger
      (debug_file, full_path))
  Exception: api-ms-win-downlevel-kernel32-l2-1-0.dll not found in "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\api-ms-win-downlevel-kernel32-l2-1-0.dll"
  
  You must installWindows 10 SDK version 10.0.19041.0 including the "Debugging Tools for Windows" feature.
  ERROR at //build/toolchain/win/BUILD.gn:49:3: Script returned non-zero exit code.
    exec_script("../../vs_toolchain.py",
    ^----------
  Current dir: C:/projects/node-webrtc-7bnua/build/external/libwebrtc/build/Release/

@geekuillaume
Copy link
Contributor Author

@markandrus I've fixed the issue with Visual Studio but there is now another weird test fail related to queue-microtask. Is this a common test fail?

@geekuillaume
Copy link
Contributor Author

@markandrus The test are finally passing ! :) I needed to remove the support for Node 11 and lower because of queue-microtask which uses globalThis and is not available in lower version. I've also disabled the destructor test as it is broken because of the getReceivers() which throws since last version. It seems related to the code to map a std::vector<RTCRtpReceiver*> to a NAPI value (https://github.com/geekuillaume/node-webrtc/blob/ea55b7b4e3e5565d3b7c717863a843fa2fdf3680/src/interfaces/rtc_peer_connection.cc#L514). Can you help me with this?

@markandrus
Copy link
Member

markandrus commented Nov 8, 2020

Thanks again, @geekuillaume. I'm in the middle of getting ready to merge this — currently upgrading web-platform-tests to see what new tests we may/may not be able to pass. Still really curious about the failing tests, too. I want to look into those. Anyway, you can see my diff below where I'm also addressing some deprecations and some new enum members. I also fixed the webrtc::DegradationPreference thing.

$ git diff
diff --git a/src/dictionaries/webrtc/rtp_parameters.cc b/src/dictionaries/webrtc/rtp_parameters.cc
index d09f80f..e36a564 100644
--- a/src/dictionaries/webrtc/rtp_parameters.cc
+++ b/src/dictionaries/webrtc/rtp_parameters.cc
@@ -2,6 +2,7 @@
 
 #include <webrtc/api/rtp_parameters.h>
 
+#include "src/converters/absl.h"
 #include "src/converters/object.h"
 #include "src/enums/webrtc/degradation_preference.h"
 #include "src/dictionaries/macros/napi.h"
@@ -27,10 +28,9 @@ TO_NAPI_IMPL(webrtc::RtpParameters, pair) {
   NODE_WEBRTC_CONVERT_AND_SET_OR_RETURN(env, object, "codecs", parameters.codecs)
   NODE_WEBRTC_CONVERT_AND_SET_OR_RETURN(env, object, "rtcp", parameters.rtcp)
   NODE_WEBRTC_CONVERT_AND_SET_OR_RETURN(env, object, "encodings", parameters.encodings)
-  // TODO: fix this
-  // if (parameters.degradation_preference != webrtc::DegradationPreference::BALANCED) {
-  //   NODE_WEBRTC_CONVERT_AND_SET_OR_RETURN(env, object, "degradationPreference", parameters.degradation_preference)
-  // }
+  if (parameters.degradation_preference != webrtc::DegradationPreference::BALANCED) {
+    NODE_WEBRTC_CONVERT_AND_SET_OR_RETURN(env, object, "degradationPreference", parameters.degradation_preference)
+  }
   return Pure(scope.Escape(object));
 }
 
diff --git a/src/enums/webrtc/rtp_transceiver_direction.h b/src/enums/webrtc/rtp_transceiver_direction.h
index efb9942..bb311de 100644
--- a/src/enums/webrtc/rtp_transceiver_direction.h
+++ b/src/enums/webrtc/rtp_transceiver_direction.h
@@ -10,7 +10,8 @@
   ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kSendRecv, "sendrecv") \
   ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kSendOnly, "sendonly") \
   ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kRecvOnly, "recvonly") \
-  ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kInactive, "inactive")
+  ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kInactive, "inactive") \
+  ENUM_SUPPORTED(RTP_TRANSCEIVER_DIRECTION::kStopped, "stopped")
 
 #define ENUM(X) RTP_TRANSCEIVER_DIRECTION ## X
 #include "src/enums/macros/decls.h"
diff --git a/src/enums/webrtc/video_frame_buffer_type.h b/src/enums/webrtc/video_frame_buffer_type.h
index ae7fed7..a603675 100644
--- a/src/enums/webrtc/video_frame_buffer_type.h
+++ b/src/enums/webrtc/video_frame_buffer_type.h
@@ -11,7 +11,8 @@
   ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kI420, "I420") \
   ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kI420A, "I420A") \
   ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kI444, "I444") \
-  ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kI010, "I010")
+  ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kI010, "I010") \
+  ENUM_SUPPORTED(VIDEO_FRAME_BUFFER_TYPE::kNV12, "NV12")
 
 #define ENUM(X) VIDEO_FRAME_BUFFER_TYPE ## X
 #include "src/enums/macros/decls.h"
diff --git a/src/interfaces/rtc_rtp_transceiver.cc b/src/interfaces/rtc_rtp_transceiver.cc
index d8637b9..04ba116 100644
--- a/src/interfaces/rtc_rtp_transceiver.cc
+++ b/src/interfaces/rtc_rtp_transceiver.cc
@@ -82,7 +82,11 @@ void RTCRtpTransceiver::SetDirection(const Napi::CallbackInfo& info, const Napi:
     Napi::TypeError::New(info.Env(), maybeDirection.ToErrors()[0]).ThrowAsJavaScriptException();
     return;
   }
-  _transceiver->SetDirection(maybeDirection.UnsafeFromValid());
+  auto error = _transceiver->SetDirectionWithError(maybeDirection.UnsafeFromValid());
+  if (!error.ok()) {
+    CONVERT_OR_THROW_AND_RETURN_VOID_NAPI(info.Env(), &error, result, Napi::Value)
+    Napi::Error(info.Env(), result).ThrowAsJavaScriptException();
+  }
 }
 
 Napi::Value RTCRtpTransceiver::GetCurrentDirection(const Napi::CallbackInfo& info) {
@@ -91,7 +95,11 @@ Napi::Value RTCRtpTransceiver::GetCurrentDirection(const Napi::CallbackInfo& inf
 }
 
 Napi::Value RTCRtpTransceiver::Stop(const Napi::CallbackInfo& info) {
-  _transceiver->Stop();
+  auto error = _transceiver->StopStandard();
+  if (!error.ok()) {
+    CONVERT_OR_THROW_AND_RETURN_NAPI(info.Env(), &error, result, Napi::Value)
+    Napi::Error(info.Env(), result).ThrowAsJavaScriptException();
+  }
   return info.Env().Undefined();
 }

@geekuillaume
Copy link
Contributor Author

I'm quite new with this codebase but do you need me for something in particular?

Anyway thanks for maintaining this project :)

@markandrus
Copy link
Member

@geekuillaume I don't need anything from you — I plan to merge your changes once I have the few follow-ups to get newer web-platform-tests running (and to also address some of the test issues you saw). Thanks again for your contribution.

@markandrus markandrus merged commit 3cc9a58 into node-webrtc:develop Nov 21, 2020
@geekuillaume
Copy link
Contributor Author

Thanks for the merge @markandrus :) Have a good weekend!

@markandrus markandrus mentioned this pull request Dec 25, 2020
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.