diff options
4 files changed, 34 insertions, 48 deletions
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 a078531b2..dd27ce911 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 @@ -131,11 +131,6 @@ public class VirtualDisplayEncoder { } @SuppressWarnings("unused") - public void setStreamingParams(int displayDensity, ImageResolution resolution, int frameRate, int bitrate, int interval, VideoStreamingFormat format, boolean stableFrameRate) { - this.streamingParams = new VideoStreamingParameters(displayDensity, frameRate, bitrate, interval, resolution, format, stableFrameRate); - } - - @SuppressWarnings("unused") public void setStreamingParams(VideoStreamingParameters streamingParams) { this.streamingParams = streamingParams; } 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 714005041..a7ed506ab 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 @@ -294,38 +294,35 @@ public class VideoStreamManager extends BaseVideoStreamManager { stateMachine.transitionToState(StreamingStateMachine.ERROR); return; } - if (parameters == null) { - if (majorProtocolVersion >= 5) { - if (internalInterface.getSystemCapabilityManager() != null) { - internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() { - @Override - public void onCapabilityRetrieved(Object capability) { - VideoStreamingParameters params = new VideoStreamingParameters(); - params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream - startStreaming(params, encrypted); - } + // regardless of VideoStreamingParameters are specified or not, we should refer to VideoStreamingCapability. + if (majorProtocolVersion >= 5) { + if (internalInterface.getSystemCapabilityManager() != null) { + final VideoStreamingParameters params = ( parameters == null) ? new VideoStreamingParameters() : new VideoStreamingParameters(parameters); + internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() { + @Override + public void onCapabilityRetrieved(Object capability) { + params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream + startStreaming(params, encrypted); + } - @Override - public void onError(String info) { - stateMachine.transitionToState(StreamingStateMachine.ERROR); - DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info); - } - }, false); - } - } else { - //We just use default video streaming params - VideoStreamingParameters params = new VideoStreamingParameters(); - DisplayCapabilities dispCap = null; - if (internalInterface.getSystemCapabilityManager() != null) { - dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false); - } - if (dispCap != null) { - params.setResolution(dispCap.getScreenParams().getImageResolution()); - } - startStreaming(params, encrypted); + @Override + public void onError(String info) { + stateMachine.transitionToState(StreamingStateMachine.ERROR); + DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info); + } + }, false); } } else { - startStreaming(parameters, encrypted); + //We just use default video streaming params + VideoStreamingParameters params = (parameters == null) ? new VideoStreamingParameters() : new VideoStreamingParameters(parameters); + DisplayCapabilities dispCap = null; + if (internalInterface.getSystemCapabilityManager() != null) { + dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false); + } + if (dispCap != null) { + params.setResolution(dispCap.getScreenParams().getImageResolution()); + } + startStreaming(params, encrypted); } } 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 c78359d92..6bc34b836 100644 --- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java +++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java @@ -79,18 +79,7 @@ public class VideoStreamingParameters { format = new VideoStreamingFormat(); format.setProtocol(DEFAULT_PROTOCOL); format.setCodec(DEFAULT_CODEC); - } - - @Deprecated - public VideoStreamingParameters(int displayDensity, int frameRate, int bitrate, int interval, - ImageResolution resolution, VideoStreamingFormat format) { - this.displayDensity = displayDensity; - this.frameRate = frameRate; - this.bitrate = bitrate; - this.interval = interval; - this.resolution = resolution; - this.format = format; - this.stableFrameRate = true; + stableFrameRate = true; } /** @@ -103,15 +92,16 @@ public class VideoStreamingParameters { * @param format * @param stableFrameRate */ + @Deprecated public VideoStreamingParameters(int displayDensity, int frameRate, int bitrate, int interval, - ImageResolution resolution, VideoStreamingFormat format, boolean stableFrameRate){ + ImageResolution resolution, VideoStreamingFormat format){ this.displayDensity = displayDensity; this.frameRate = frameRate; this.bitrate = bitrate; this.interval = interval; this.resolution = resolution; this.format = format; - this.stableFrameRate = stableFrameRate; + this.stableFrameRate = true; } /** @@ -171,6 +161,7 @@ public class VideoStreamingParameters { this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps. double scale = DEFAULT_SCALE; + // For resolution and scale, the capability values should be taken rather than parameters specified by developers. if (capability.getScale() != null) { scale = capability.getScale(); } @@ -197,6 +188,9 @@ public class VideoStreamingParameters { // This should be the last call as it will return out once a suitable format is found final List<VideoStreamingFormat> formats = capability.getSupportedFormats(); if (formats != null && formats.size() > 0) { + if (this.format != null && formats.contains(this.format)) { + return; // given format is supported, so no need to change. + } for (VideoStreamingFormat format : formats) { for (VideoStreamingFormat currentlySupportedFormat : currentlySupportedFormats) { if (currentlySupportedFormat.equals(format)) { diff --git a/generator/rpc_spec b/generator/rpc_spec -Subproject 762489ca140f246923e8bb8f54e96364e9d0101 +Subproject 1a8d4a28ebdf4410a63e22ce7a1792d9e5cd7e4 |