summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Castillo <fcastillo@luxoft.com>2019-07-22 10:12:46 -0500
committerFernando Castillo <fcastillo@luxoft.com>2019-07-22 10:16:23 -0500
commit4f0c5aabb88aae4b98308f0552089fd023355237 (patch)
treea7893df56d21974ccf4889bdc9c8174719af2769
parent31c5b1f78b5f90c6f18a8df76b462d4752ab040d (diff)
downloadsdl_android-4f0c5aabb88aae4b98308f0552089fd023355237.tar.gz
[SDL 0179]Pixel density and Scale
Fixes https://github.com/smartdevicelink/sdl_java_suite/issues/804 The main change is related to changing the size of the view captured. This is done by adding a new scale parameter in the video streaming capability and by dividing the preferred resolution from the HMI and the scale. Changes in the calculation of the touch coordinates are not needed due to the array VideoStreamManager.touchScalar, this array is already handling the differences in the size between the preferred resolution and the captured view. The touch coordinates are correctly being divided by the scale value.
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java20
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java7
-rw-r--r--android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java129
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java31
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java37
7 files changed, 264 insertions, 11 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
index 76bce2e7a..f456b33b3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.managers.video;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
@@ -15,6 +16,7 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.TouchCoord;
@@ -450,4 +452,49 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
+
+ public void testConvertTouchEvent_Scale_1() {
+ assertMotionEventWithScale(800, 480, 1.0f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_25() {
+ assertMotionEventWithScale(1280, 768, 1.25f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_5() {
+ assertMotionEventWithScale(1280, 768, 1.5f);
+ }
+
+ private void assertMotionEventWithScale(int width, int height, float scale) {
+ ISdl internalInterface = mock(ISdl.class);
+
+ // Preferred Resolution capability
+ ImageResolution resolution = new ImageResolution(width, height);
+
+ // Remote display
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ displayMetrics.widthPixels = (int) (resolution.getResolutionWidth() / scale);
+ displayMetrics.heightPixels = (int) (resolution.getResolutionHeight() / scale);
+
+
+ VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.createTouchScalar(resolution, displayMetrics);
+
+ List<MotionEvent> motionEventList;
+ long e1TS = 1558124390L;
+ int e1x = 50, e1y = 100;
+ int e1Id = 100;
+ OnTouchEvent testOnTouchEvent;
+ MotionEvent motionEvent;
+ TouchEvent touchEvent1 = new TouchEvent(e1Id, Collections.singletonList(e1TS), Collections.singletonList(new TouchCoord(e1x, e1y)));
+
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+
+
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(Math.round(e1x / scale), Math.round(motionEvent.getX(0)));
+ assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 54cfc1a22..27045a015 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -14,9 +14,11 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
public class VideoStreamingCapabilityTests extends TestCase {
@@ -30,6 +32,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
msg.setMaxBitrate(Test.GENERAL_INT);
msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
+ msg.setDiagonalScreenSize(Test.GENERAL_DOUBLE);
+ msg.setPixelPerInch(Test.GENERAL_DOUBLE);
+ msg.setScale(Test.GENERAL_DOUBLE);
}
/**
@@ -41,12 +46,18 @@ public class VideoStreamingCapabilityTests extends TestCase {
ImageResolution res = msg.getPreferredResolution();
Integer maxBitrate = msg.getMaxBitrate();
Boolean isHapticSpatialDataSupported = msg.getIsHapticSpatialDataSupported();
+ Double diagonalScreenSize = msg.getDiagonalScreenSize();
+ Double pixelPerInch = msg.getPixelPerInch();
+ Double scale = msg.getScale();
// Valid Tests
assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, diagonalScreenSize);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, pixelPerInch);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, scale);
// Invalid/Null Tests
VideoStreamingCapability msg = new VideoStreamingCapability();
@@ -56,6 +67,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getPreferredResolution());
assertNull(Test.NULL, msg.getSupportedFormats());
assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
+ assertNull(Test.NULL, msg.getDiagonalScreenSize());
+ assertNull(Test.NULL, msg.getPixelPerInch());
+ assertNull(Test.NULL, msg.getScale());
}
public void testJson() {
@@ -66,6 +80,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_SCALE, Test.GENERAL_DOUBLE);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -87,6 +104,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
for(VideoStreamingFormat vsf : vsfReference){
assertTrue(Validator.validateSupportedFormats(vsf, new VideoStreamingFormat(JsonRPCMarshaller.deserializeJSONObject(vsfArray.getJSONObject(i++)))));
}
+ } else if (key.equals(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE) || key.equals(VideoStreamingCapability.KEY_PIXEL_PER_INCH) ||
+ key.equals(VideoStreamingCapability.KEY_SCALE)) {
+ assertEquals(JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key), 0.0005);
}
}
} catch (JSONException e) {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
index 6b7f2a686..bff0e2f22 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
@@ -107,8 +107,8 @@ public class VirtualDisplayEncoder {
}
@SuppressWarnings("unused")
- public void setStreamingParams(int displayDensity, ImageResolution resolution, int frameRate, int bitrate, int interval, VideoStreamingFormat format) {
- this.streamingParams = new VideoStreamingParameters(displayDensity, frameRate, bitrate, interval, resolution, format);
+ public void setStreamingParams(int displayDensity, ImageResolution resolution, int frameRate, int bitrate, int interval, double scale, VideoStreamingFormat format) {
+ this.streamingParams = new VideoStreamingParameters(displayDensity, frameRate, bitrate, interval, scale, resolution, format);
}
@SuppressWarnings("unused")
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
index 49798078c..4277202c1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
@@ -453,7 +453,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
disp.getMetrics(displayMetrics);
touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
- }
+ }
}
@@ -499,6 +499,11 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
+ void createTouchScalar(ImageResolution resolution, DisplayMetrics displayMetrics) {
+ touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
+ touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
+ }
+
List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent){
List<MotionEvent> motionEventList = new ArrayList<MotionEvent>();
diff --git a/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java b/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java
new file mode 100644
index 000000000..cd13fb624
--- /dev/null
+++ b/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.streaming.video;
+
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class VideoStreamingParametersTest {
+ private VideoStreamingParameters params;
+ private VideoStreamingParameters otherParameters;
+ private VideoStreamingCapability capability;
+ private ImageResolution preferredResolution;
+
+ @Before
+ public void setUp() {
+ params = new VideoStreamingParameters();
+ capability = new VideoStreamingCapability();
+ otherParameters = new VideoStreamingParameters();
+ }
+
+ @Test
+ public void defaultValue_Scale() {
+ assertEquals(1.0, params.getScale(), 0.005);
+ }
+
+ @Test
+ public void update_Scale() {
+ double expectedValue = 3.0;
+ otherParameters.setScale(expectedValue);
+ params = new VideoStreamingParameters(otherParameters);
+ assertEquals(expectedValue, params.getScale(), 0.005);
+ }
+
+ @Test
+ public void test_toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("VideoStreamingParams - format: {codec=H264, protocol=RAW}, ");
+ builder.append("resolution: {576, 1024}, ");
+ builder.append("frame rate: {30}, ");
+ builder.append("displayDensity: {240}, ");
+ builder.append("bitrate: {512000}, ");
+ builder.append("IFrame interval: {5}, ");
+ builder.append("scale: {1.0}");
+
+ assertEquals(builder.toString(), params.toString());
+ }
+
+ @Test
+ public void update_Scale_1_Resolution_800_354() {
+ preferredResolution = new ImageResolution(800, 354);
+
+ capability.setScale(1.0);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(800, width);
+ assertEquals(354, height);
+ }
+
+ @Test
+ public void update_Scale_1_25_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.25);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(1024, width);
+ assertEquals(455, height);
+ }
+
+ @Test
+ public void update_Scale_1_5_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.5);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(853, width);
+ assertEquals(379, height);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
index e3bd9425c..2005ccf50 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -32,6 +32,7 @@
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
import java.util.List;
@@ -45,6 +46,9 @@ public class VideoStreamingCapability extends RPCStruct {
public static final String KEY_MAX_BITRATE = "maxBitrate";
public static final String KEY_SUPPORTED_FORMATS = "supportedFormats";
public static final String KEY_HAPTIC_SPATIAL_DATA_SUPPORTED = "hapticSpatialDataSupported";
+ public static final String KEY_DIAGONAL_SCREEN_SIZE = "diagonalScreenSize";
+ public static final String KEY_PIXEL_PER_INCH = "pixelPerInch";
+ public static final String KEY_SCALE = "scale";
public VideoStreamingCapability(){}
public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);}
@@ -92,4 +96,31 @@ public class VideoStreamingCapability extends RPCStruct {
public void setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
}
+
+ public Double getDiagonalScreenSize() {
+ Object object = getValue(KEY_DIAGONAL_SCREEN_SIZE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ public void setDiagonalScreenSize(Double diagonalScreenSize) {
+ setValue(KEY_DIAGONAL_SCREEN_SIZE, diagonalScreenSize);
+ }
+
+ public Double getPixelPerInch() {
+ Object object = getValue(KEY_PIXEL_PER_INCH);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ public void setPixelPerInch(Double pixelPerInch) {
+ setValue(KEY_PIXEL_PER_INCH, pixelPerInch);
+ }
+
+ public Double getScale() {
+ Object object = getValue(KEY_SCALE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ public void setScale(Double scale) {
+ setValue(KEY_SCALE, scale);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index 09919c598..db0eac3dd 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -50,12 +50,14 @@ public class VideoStreamingParameters {
private final int DEFAULT_FRAMERATE = 30;
private final int DEFAULT_BITRATE = 512000;
private final int DEFAULT_INTERVAL = 5;
+ private final double DEFAULT_SCALE = 1.0;
private int displayDensity;
private int frameRate;
private int bitrate;
private int interval;
+ private double scale;
private ImageResolution resolution;
private VideoStreamingFormat format;
@@ -64,6 +66,7 @@ public class VideoStreamingParameters {
frameRate = DEFAULT_FRAMERATE;
bitrate = DEFAULT_BITRATE;
interval = DEFAULT_INTERVAL;
+ scale = DEFAULT_SCALE;
resolution = new ImageResolution();
resolution.setResolutionWidth(DEFAULT_WIDTH);
resolution.setResolutionHeight(DEFAULT_HEIGHT);
@@ -73,11 +76,13 @@ public class VideoStreamingParameters {
}
public VideoStreamingParameters(int displayDensity, int frameRate, int bitrate, int interval,
- ImageResolution resolution, VideoStreamingFormat format){
+ double scale, ImageResolution resolution,
+ VideoStreamingFormat format){
this.displayDensity = displayDensity;
this.frameRate = frameRate;
this.bitrate = bitrate;
this.interval = interval;
+ this.scale = scale;
this.resolution = resolution;
this.format = format;
}
@@ -88,6 +93,7 @@ public class VideoStreamingParameters {
*/
@SuppressWarnings("unused")
public VideoStreamingParameters(VideoStreamingParameters params){
+ resolution = new ImageResolution();
update(params);
}
@@ -109,6 +115,9 @@ public class VideoStreamingParameters {
if (params.interval > 0) {
this.interval = params.interval;
}
+ if(params.scale > 0.0) {
+ this.scale = params.scale;
+ }
if (params.resolution != null) {
if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) {
this.resolution.setResolutionHeight(params.resolution.getResolutionHeight());
@@ -132,10 +141,12 @@ public class VideoStreamingParameters {
*/
public void update(VideoStreamingCapability capability){
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
+ if(capability.getScale() != null) { scale = capability.getScale(); }
ImageResolution resolution = capability.getPreferredResolution();
if(resolution!=null){
- if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight(resolution.getResolutionHeight()); }
- if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth(resolution.getResolutionWidth()); }
+
+ if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }
+ if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth((int)(resolution.getResolutionWidth() / scale)); }
}
List<VideoStreamingFormat> formats = capability.getSupportedFormats();
if(formats != null && formats.size()>0){
@@ -177,6 +188,14 @@ public class VideoStreamingParameters {
return interval;
}
+ public void setScale(double scale) {
+ this.scale = scale;
+ }
+
+ public double getScale() {
+ return scale;
+ }
+
public void setFormat(VideoStreamingFormat format){
this.format = format;
}
@@ -200,16 +219,18 @@ public class VideoStreamingParameters {
builder.append(format.toString());
builder.append("}, resolution: {");
builder.append(resolution.getResolutionHeight());
- builder.append(" , ");
+ builder.append(", ");
builder.append(resolution.getResolutionWidth());
- builder.append("}, frame rate {");
+ builder.append("}, frame rate: {");
builder.append(frameRate);
- builder.append("}, displayDensity{ ");
+ builder.append("}, displayDensity: {");
builder.append(displayDensity);
- builder.append("}, bitrate");
+ builder.append("}, bitrate: {");
builder.append(bitrate);
- builder.append("}, IFrame interval{ ");
+ builder.append("}, IFrame interval: {");
builder.append(interval);
+ builder.append("}, scale: {");
+ builder.append(scale);
builder.append("}");
return builder.toString();
}