我想在带有 ios AppRTCDemo 的 iPhone 4s 和带有 android AppRTCDemo 的 nexus 4 之间进行流畅的视频通话。 我希望视频有一定的质量,基本上越高越好,但 480x640 可以满足我目前的需求。
我在每台设备上运行 AppRTCDemo(来自 r6783)(每台设备都有适用于其平台的 apprtcDemo)。
我为本地视频设置了约束:
RTCPair *localVideoMaxWidth = [[RTCPair alloc] initWithKey:@"maxWidth" value:@"640"];
RTCPair *localVideoMinWidth = [[RTCPair alloc] initWithKey:@"minWidth" value:@"640"];
RTCPair *localVideoMaxHeight = [[RTCPair alloc] initWithKey:@"maxHeight" value:@"480"];
RTCPair *localVideoMinHeight = [[RTCPair alloc] initWithKey:@"minHeight" value:@"480"];
RTCPair *localVideoMaxFrameRate = [[RTCPair alloc] initWithKey:@"maxFrameRate" value:@"30"];
RTCPair *localVideoMinFrameRate = [[RTCPair alloc] initWithKey:@"minFrameRate" value:@"5"];
RTCPair *localVideoGoogLeakyBucket = [[RTCPair alloc] initWithKey:@"googLeakyBucket" value:@"true"];
RTCMediaConstraints *videoSourceConstraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:@[localVideoMaxHeight, localVideoMaxWidth, localVideoMinHeight, localVideoMinWidth, localVideoMinFrameRate, localVideoMaxFrameRate, localVideoGoogLeakyBucket] optionalConstraints:@[]];
RTCMediaStream *localMediaStream = [self.peerConnectionFactory mediaStreamWithLabel:@"ARDAMS"];
NSString *cameraID = @"Back Camera";
NSAssert(cameraID, @"Unable to get the back camera id");
RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:cameraID];
self.videoSource = [self.peerConnectionFactory videoSourceWithCapturer:capturer constraints:videoSourceConstraints];
在android AppRTCDemo 中为本地视频源设置相同的约束。
这是发生了什么:
开始通话,然后我得到本地视频源
在其他对等方加入通话之前,视频看起来不错且流畅(来自本地摄像头)。
在其他节点加入后立即:
当通话开始时(双方都在通话中)我收到了很多这样的消息:
Estimated available bandwidth 29 kbps is below configured min bitrate 30 kbps.
然后:
Warning(webrtcvideoengine.cc:1469): webrtc: (send_side_bandwidth_estimation.cc:206): Estimated available bandwidth 29 kbps is below configured min bitrate 30 kbps.
Warning(webrtcvideoengine.cc:1469): webrtc: (send_side_bandwidth_estimation.cc:206): Estimated available bandwidth 29 kbps is below configured min bitrate 30 kbps.
Warning(webrtcvideoengine.cc:1469): webrtc: (send_side_bandwidth_estimation.cc:206): Estimated available bandwidth 29 kbps is below configured min bitrate 30 kbps.
VAdapt Frame: scaled 240 / out 1620 / in 1620 Changes: 2 Input: 480x640 i33333333 Scale: 0.5 Output: 240x320 i33333333 Changed: false
VAdapt CPU Request: keep Steps: 2 Changed: false To: 240x320
VAdapt CPU Request: down Steps: 2 Changed: false To: 240x320
VAdapt Frame: scaled 330 / out 1710 / in 1710 Changes: 2 Input: 480x640 i33333333 Scale: 0.5 Output: 240x320 i33333333 Changed: false
VAdapt CPU Request: keep Steps: 2 Changed: false To: 240x320
VAdapt Frame: scaled 420 / out 1800 / in 1800 Changes: 2 Input: 480x640 i33333333 Scale: 0.5 Output: 240x320 i33333333 Changed: false
VAdapt CPU Request: down Steps: 2 Changed: false To: 240x320
当我收到消息时:VAdapt CPU Request: keep Steps: 2 Changed: false To: 240x320
然后这条消息:“Estimated available bandwidth 29 kbps is below configured min bitrate 30 kbps
”停止并且分辨率设置为较低(我想这是预期的行为)但我想将分辨率保持在 640x480。
在那之后,视频馈送出现延迟,但奇怪的是,延迟似乎来自本地摄像机 View ,本地摄像机本身的馈送显示有很小的延迟,因此视频传输对其他同行的延迟和较低的分辨率。
我尝试使用较低的分辨率 (320x240),当设置较低的分辨率时效果很好,但较低分辨率的质量对我来说太低了。
(我还测试了 2 台安卓设备,通话似乎正常(分辨率设置为 640x480。
我该怎么做才能在 640x480 分辨率下在 iphone 和 android 设备之间顺利进行通话?
我是否可以设置任何其他限制以使其正常工作?
我在某处读到有关漏桶约束的内容,但没有帮助。 (另外,我不完全确定我将约束放在正确的位置)
谢谢
更新:
经过更多测试后,将 maxFrameRate 限制减少到 15 有助于“显示来自本地相机本身的馈送具有较小的延迟”。有了新的约束,几乎没有延迟,视频质量似乎几乎保持不变,但分辨率仍设置为 320x240
最佳答案
经过大量测试并在 discuss-webrtc 上讨论了很多主题之后我意识到 iPhone 4s 不够“强大”以运行 640x480 分辨率的流畅通话,似乎会产生高 CPU 然后降低分辨率。它甚至在 352x288 分辨率下挣扎...
关于ios - 使用分辨率设置为 480x640 的 iOS AppRTCDemo 进行调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25136887/