DescriptionAndroid SurfaceViewRenderer: Don't rely on widthSpec/heightSpec after onMeasure() returns
SurfaceViewRenderer currently stores widthSpec/heightSpec internally, and triggers requestLayout() from renderFrameOnRenderThread()->checkConsistentLayout() when it detects a change using widthSpec/heightSpec. This is not reliable, because onMeasure() might be called several times during the layout process negotiation. For example it might look like this:
-> onMeasure(at most 1920, at most 1080)
<- setMeasuredDimension(1080, 1080)
-> onMeasure(exactly 1080, exactly 1080)
<- setMeasuredDimension(1080, 1080)
Then we store (exactly 1080, exactly 1080) even though we are allowed to be bigger than this, and requestLayout() will never be triggered.
This CL moves the requestLayout() trigger to updateFrameDimensionsAndReportEvents() when the frame size changes.
Other small changes in this CL are:
* Replace with/height variables with Point.
* Add logging in updateFrameDimensionsAndReportEvents() even when rendererEvents is null.
* Use Math.round() in RendererCommon.getDisplaySize() instead of integer cast.
R=hbos@webrtc.org
Committed: https://crrev.com/4c5eea3c73e90b11bc17679d6b0943813e4c5038
Cr-Commit-Position: refs/heads/master@{#10774}
Patch Set 1 #
Total comments: 11
Patch Set 2 : Addressing hbos@ comments #Patch Set 3 : #
Messages
Total messages: 12 (5 generated)
|