File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
rtsp-client/src/main/java/ir/am3n/rtsp/client/codec Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 8282
8383 <SurfaceView
8484 android : id =" @+id/svVideo"
85- android : layout_width =" match_parent "
85+ android : layout_width =" wrap_content "
8686 android : layout_height =" wrap_content" />
8787
8888 <ProgressBar
Original file line number Diff line number Diff line change @@ -40,7 +40,15 @@ internal class VideoDecoder(
4040 srcRect.bottom = height
4141 dstRect.right = width
4242 dstRect.bottom = height
43- surfaceView?.holder?.setFixedSize(width, height)
43+ if (width > height) {
44+ val rate = (surfaceView?.measuredWidth ? : 0 ).toFloat() / width.toFloat()
45+ val height = (height * rate).toInt()
46+ surfaceView?.holder?.setFixedSize(width, height)
47+ } else {
48+ val rate = (surfaceView?.measuredHeight ? : 0 ).toFloat() / height.toFloat()
49+ val width = (width * rate).toInt()
50+ surfaceView?.holder?.setFixedSize(width, height)
51+ }
4452 }
4553
4654 fun stopAsync () {
You can’t perform that action at this time.
0 commit comments