Relax VideoCaptureImpl::IncomingFrame size check
When testing manually with gstreamer and v4l2loopback, the incoming buffer is often larger than the expected size. This change allows such frames, while still logging the error. Bug: webrtc:14830 Change-Id: I399aa55af6437d75b50830166a667547f6d144d4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291530 Commit-Queue: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39972}
This commit is contained in:
parent
14d4e9f186
commit
b1a174041d
@ -149,11 +149,17 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not encoded, convert to I420.
|
// Not encoded, convert to I420.
|
||||||
if (frameInfo.videoType != VideoType::kMJPEG &&
|
if (frameInfo.videoType != VideoType::kMJPEG) {
|
||||||
CalcBufferSize(frameInfo.videoType, width, abs(height)) !=
|
// Allow buffers larger than expected. On linux gstreamer allocates buffers
|
||||||
videoFrameLength) {
|
// page-aligned and v4l2loopback passes us the buffer size verbatim which
|
||||||
RTC_LOG(LS_ERROR) << "Wrong incoming frame length.";
|
// for most cases is larger than expected.
|
||||||
return -1;
|
// See https://github.com/umlaeute/v4l2loopback/issues/190.
|
||||||
|
if (auto size = CalcBufferSize(frameInfo.videoType, width, abs(height));
|
||||||
|
videoFrameLength < size) {
|
||||||
|
RTC_LOG(LS_ERROR) << "Wrong incoming frame length. Expected " << size
|
||||||
|
<< ", Got " << videoFrameLength << ".";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int stride_y = width;
|
int stride_y = width;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user