我面临着这个奇怪的问题,SurfaceViewRenderer每当我在横向/反向横向/传感器横向中运行活动时,预览就会变成空白。奇怪的问题是,在某些手机中,视频预览以反向横向模式工作,而在某些手机中以横向模式工作。例如,当我在 中运行 Activity 时Android 5.0,横向模式下的视频预览工作正常,但在反向横向模式下则不行。然后我尝试在我正在运行的一加手机上执行相同的操作Android 10。这里 SurfaceViewRenderer 中的视频预览在反向横向模式下工作正常,但在横向模式下则不然。
注意:即使预览变为空白,远程流也可以正常工作,没有任何问题,只有视频预览不起作用。它以某种方式无法更新,SurfaceViewRenderer但没有问题流向远程参与者。
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.session.activities.LiveSessionActivity">
<org.webrtc.SurfaceViewRenderer
android:id="@+id/localGLSurfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
<View
android:id="@+id/vBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.4"
android:background="@android:color/black"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/localGLSurfaceView"
app:layout_constraintEnd_toEndOf="@+id/localGLSurfaceView"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/localGLSurfaceView"
app:layout_constraintTop_toTopOf="@+id/localGLSurfaceView"
app:layout_constraintVertical_bias="0.0" />
<View
android:id="@+id/vShadow"
android:layout_width="wrap_content"
android:layout_height="@dimen/_42sdp"
android:background="@drawable/ic_rectangle_shadow"
app:layout_constraintEnd_toEndOf="@+id/localGLSurfaceView"
app:layout_constraintStart_toStartOf="@+id/localGLSurfaceView"
app:layout_constraintTop_toTopOf="@+id/localGLSurfaceView" />
<ImageView
android:id="@+id/ivBackButton"
android:layout_width="@dimen/_8sdp"
android:layout_height="@dimen/_13sdp"
android:layout_marginStart="@dimen/_12sdp"
android:layout_marginTop="@dimen/_16sdp"
android:src="@drawable/ic_back"
app:layout_constraintStart_toStartOf="@+id/localGLSurfaceView"
app:layout_constraintTop_toTopOf="@+id/localGLSurfaceView" />
<TextView
android:id="@+id/tvLiveClassName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_12sdp"
android:text="Live Class 10"
android:textColor="@android:color/white"
android:textSize="@dimen/medium_text"
app:layout_constraintBottom_toBottomOf="@+id/ivBackButton"
app:layout_constraintStart_toEndOf="@+id/ivBackButton"
app:layout_constraintTop_toTopOf="@+id/ivBackButton" />
<TextView
android:id="@+id/tvCountDown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:textColor="@android:color/white" …Run Code Online (Sandbox Code Playgroud) 我们的 iOS (swift) 本机应用程序与OpenVidu实现(在后台使用GoogleWebRTC )存在挂起问题(应用程序由于主线程锁定而冻结)。所需具体条件:需要加入现有房间且至少有 8 名参与者已经在直播。如果参与者有 6 个,则这种情况发生的频率会较低,并且在少于 6 个参与者的情况下几乎不会出现这种情况。如果参与者逐一加入,只有当您加入房间且所有其他参与者都已在进行流式传输时,它才不会挂起。这表明了问题的并发性质。
GoogleWebRTC 挂起setRemoteDescription:
func setRemoteDescription(sdpAnswer: String) {
let sessionDescription: RTCSessionDescription = RTCSessionDescription(type: RTCSdpType.answer, sdp: sdpAnswer)
self.peerConnection!.setRemoteDescription(sessionDescription, completionHandler: {(error) in
print("Local Peer Remote Description set: " + error.debugDescription)
})
}
Run Code Online (Sandbox Code Playgroud)
正如您在上面的屏幕截图中看到的,主线程挂在 上__psynch_cvwait。似乎没有任何其他线程被锁定。锁永远不会释放,导致应用程序完全冻结。
在尝试解决这个问题时,我尝试了以下方法:
我将 OpenVidu 信令服务器处理(RPC 协议)从主线程移至单独的线程中。这只会导致锁定现在发生在我创建的单独线程之一中。现在它不会阻止 UI,但会阻止 OV 信号。问题仍然存在。
我添加了锁来同步(一一)处理每个信令事件(参与者加入事件、发布视频等) 。这也无济于事(它实际上使情况变得更糟)。
我没有使用 Cocoapods 中的 GoogleWebRTC v. 1.1.31999,而是下载了最新的 GoogleWebRTC 源代码,在发布配置中构建它们并包含在我的项目中。这无助于解决问题。
任何建议/意见将不胜感激。谢谢!
编辑1:
和signaling_threadareworker_thread都在同一种锁中等待某些东西。在锁定时,它们都不会执行我的任何代码。
我还尝试在 …
我一直在想办法计算以下内容: 带宽、延迟、当前上传和下载速度。并且对我为INBOUND-RTP、OUTBOUND-RTP 和 REMOTE-INBOUND-RTP获得的值感到困惑。
在我的脑海中,我正在考虑将inbound-rtp作为所有传入数据的统计信息的集合。这显然是错误的,因为该类型的不同统计数据始终为零
当前设置使用 chrome 作为 2 个连接客户端和一个媒体服务器,客户端实例在“ localhost ”上运行
我需要在我的应用程序中实现视频通话,然后我发现了 webrtc,以及 nodejs 的 simple-peer。我只有一个问题,因为它是点对点的,我想用户不是匿名的,他们可以互相获取他们的 ip。
我知道 facebook、amazon chime 使用 webrtc,他们如何隐藏这些 ip?他们是否通过服务器传递流?使用转服务器?openvidu 会隐藏 ip 吗?或者我可以简单地为每个视频室在 nodejs 进程中创建对等点,并连接到每个用户并分发视频?
谢谢