Skip to content

Commit 894f894

Browse files
committed
Add flag to prevent multiple cap listeners in VSM
1 parent 33d2fbb commit 894f894

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
117117
private String vehicleMake = null;
118118
private boolean isEncrypted = false;
119119
private boolean withPendingRestart = false;
120+
private boolean wasCapabilityListenerAdded = false;
120121
private AbstractPacketizer videoPacketizer;
121122

122123
// INTERNAL INTERFACES
@@ -188,7 +189,10 @@ public void onNotified(RPCNotification notification) {
188189
if (VideoStreamManager.this.parameters == null) {
189190
getVideoStreamingParams();
190191
}
191-
internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, systemCapabilityListener);
192+
if (!wasCapabilityListenerAdded) {
193+
wasCapabilityListenerAdded = true;
194+
internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, systemCapabilityListener);
195+
}
192196
}
193197
checkState();
194198
if (hasStarted && (isHMIStateVideoStreamCapable(prevOnHMIStatus)) && (!isHMIStateVideoStreamCapable(currentOnHMIStatus))) {

0 commit comments

Comments
 (0)