Bug 1453740 - Allow 1x1 windows in VP8EncoderImpl::InitEncode; r?pehrsons draft
authorDan Minor <dminor@mozilla.com>
Thu, 12 Apr 2018 11:31:59 -0700
changeset 781204 cb0b5603747116b21353028612a56da0080522ac
parent 781042 ee1d1bf1dc8a83eec16967ddb61dd5024c8d6058
push id106245
push userdminor@mozilla.com
push dateThu, 12 Apr 2018 18:34:38 +0000
reviewerspehrsons
bugs1453740
milestone61.0a1
Bug 1453740 - Allow 1x1 windows in VP8EncoderImpl::InitEncode; r?pehrsons A minimized window has a resolution of 1x1. Although we removed minimized windows from the list of available windows to share, nothing prevents the user from minimizing it during a call. With the current code, this will cause InitEncode to fail, resulting in a fatal release assert. I tested this patch with window sharing on meet.google.com and I was able to minimize and restore the window several times without problem. While minimized, the window appears as a black screen to the other meeting participants. It renders normally when restored. MozReview-Commit-ID: LE2NBiEy8nw
media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
--- a/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -295,17 +295,17 @@ int VP8EncoderImpl::InitEncode(const Vid
   }
   if (inst->maxFramerate < 1) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }
   // allow zero to represent an unspecified maxBitRate
   if (inst->maxBitrate > 0 && inst->startBitrate > inst->maxBitrate) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }
-  if (inst->width <= 1 || inst->height <= 1) {
+  if (inst->width < 1 || inst->height < 1) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }
   if (number_of_cores < 1) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }
   if (inst->VP8().feedbackModeOn && inst->numberOfSimulcastStreams > 1) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }