Any hint for resizing/padding peer`s videos on Android?

989 views
Skip to first unread message

haoc

unread,
Mar 25, 2015, 4:55:55 PM3/25/15
to discuss...@googlegroups.com
Hi,

Is it possible to pad/resize the received video automatically on Android when the remote video size is changed? Let`s say I have received a peer`s video with resolution 640X480 initially and it matched the video view perfectly. Then somehow this video changed to 640X800 and only part of this video is displayed. What I want is to keep the video view`s size and ratio on my phone and resize the video to match the view.

I am developing my app on Android using webrtc`s java APIs. I am guessing I will need to modify setSize() function in VideoRenderGui.java but I don`t know how to do that.

Thank you.

gla...@webrtc.org

unread,
Mar 26, 2015, 12:20:53 AM3/26/15
to discuss...@googlegroups.com
Try to use VideoRenderGui.ScalingType.SCALE_ASPECT_FIT when configuring video renderer instead of SCALE_ASPECT_FILL. In this mode video will not be cropped and will be scaled to fit the display window.

haoc

unread,
Mar 26, 2015, 6:14:17 PM3/26/15
to discuss...@googlegroups.com
Thank you for the reply.
I changed the scale type to SCALE_ASPECT_FIT and it worked. But the video will be distorted on both devices and emulators. And the app crashed somehow only on devices(nexus6, nexus7, and note4 at least). I searched the error code and it pointed to a openGL related error.
The attached are the error log and screenshots of video display on nexus 7.
 
Thanks again for your help!
crash_log_nexus7.rtf
Screen Shot 2015-03-26 at 5.11.34 PM.png
Screen Shot 2015-03-26 at 5.11.14 PM.png

haoc

unread,
Mar 26, 2015, 6:56:19 PM3/26/15
to discuss...@googlegroups.com
I am thinking this error is caused by some functions in VIdeoRendererGui. If I set the remote video in a certain width, no matter what height is, its display is correct (no distorted) and app never crash. But for other video width all the errors showed up.

gla...@webrtc.org

unread,
Mar 27, 2015, 1:05:13 PM3/27/15
to discuss...@googlegroups.com
Can you file a bug for it and attach a full logcat output?
Seems like you are using some custom video resolution 932x878 - do you get it from Android camera or from other source?
Does the app crash both in SCALE_ASPECT_FIT and SCALE_ASPECT_FILL modes with this resolution or only in SCALE_ASPECT_FIT renderer mode?

haoc

unread,
Mar 27, 2015, 1:24:53 PM3/27/15
to discuss...@googlegroups.com
Can you file a bug for it and attach a full logcat output?
-- yes. https://code.google.com/p/webrtc/issues/list is it the right place to file a bug?


Seems like you are using some custom video resolution 932x878 - do you get it from Android camera or from other source?
--I am sharing my screen/application from chrome to android. So the video source is from screensharing and the resolution of this video may be changed to any value.

Does the app crash both in SCALE_ASPECT_FIT and SCALE_ASPECT_FILL modes with this resolution or only in SCALE_ASPECT_FIT renderer mode?
-- yes. it crashed in both rednderer mode.

Vikas

unread,
Mar 27, 2015, 1:29:20 PM3/27/15
to discuss...@googlegroups.com
 

On Friday, March 27, 2015 at 10:24:53 AM UTC-7, haoc wrote:
Can you file a bug for it and attach a full logcat output?
-- yes. https://code.google.com/p/webrtc/issues/list is it the right place to file a bug?
 
Yes you can file one there. 

Pengli Xiao

unread,
Jun 12, 2015, 1:35:18 PM6/12/15
to discuss...@googlegroups.com
I met exactly the same problem as you came across. With certain width, it worked whatever the height is. Have u resolved this problem?  Or is it webrtc's problem?


On Thursday, March 26, 2015 at 3:56:19 PM UTC-7, haoc wrote:

haoc

unread,
Jun 12, 2015, 3:14:28 PM6/12/15
to discuss...@googlegroups.com
Unfortunately no. Seems the render only works for some certain aspect ratios or resolutions. Here is the bug I submitted before. https://code.google.com/p/webrtc/issues/detail?id=4482&sort=-id&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20Area%20Status%20Owner%20Summary&start=100
Reply all
Reply to author
Forward
0 new messages