Skip to content

Commit 64ade94

Browse files
authored
Merge pull request #1808 from smartdevicelink/video_streaming_restart_error
Fix auto restart video stream to ensure hmi level is streamable
2 parents c163c17 + eea49e9 commit 64ade94

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ public void shutDown() {
251251
inputSurface.release();
252252
inputSurface = null;
253253
}
254+
if (mEglCore != null) {
255+
mEglCore.release();
256+
mEglCore = null;
257+
}
254258
} catch (Exception ex) {
255259
DebugTool.logError(TAG, "shutDown() failed");
256260
}
@@ -262,6 +266,9 @@ public void shutDown() {
262266
* @param Height
263267
*/
264268
private void setupGLES(int Width, int Height) {
269+
if (mEglCore != null) {
270+
mEglCore.release();
271+
}
265272
mEglCore = new EglCore(null, 0);
266273

267274
// This 1x1 offscreen is created just to get the texture name (mTextureId).

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,15 @@ public void onServiceStarted(SdlSession session, SessionType type, boolean isEnc
163163
public void onServiceEnded(SdlSession session, SessionType type) {
164164
if (SessionType.NAV.equals(type)) {
165165
if (remoteDisplay != null) {
166-
stopStreaming(withPendingRestart);
166+
if (withPendingRestart && isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
167+
stopStreaming(withPendingRestart);
168+
} else {
169+
stopStreaming();
170+
}
167171
}
168172
stateMachine.transitionToState(StreamingStateMachine.NONE);
169173
transitionToState(SETTING_UP);
170-
171-
if (withPendingRestart) {
174+
if (withPendingRestart && isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
172175
VideoStreamManager manager = VideoStreamManager.this;
173176
manager.internalInterface.startVideoService(manager.getLastCachedStreamingParameters(), manager.isEncrypted, withPendingRestart);
174177
}
@@ -207,6 +210,10 @@ public void onNotified(RPCNotification notification) {
207210
if (hasStarted && (isHMIStateVideoStreamCapable(prevOnHMIStatus)) && (!isHMIStateVideoStreamCapable(currentOnHMIStatus))) {
208211
stopVideoStream();
209212
}
213+
if (withPendingRestart && hasStarted && (!isHMIStateVideoStreamCapable(prevOnHMIStatus)) && (isHMIStateVideoStreamCapable(currentOnHMIStatus))) {
214+
VideoStreamManager manager = VideoStreamManager.this;
215+
manager.internalInterface.startVideoService(manager.getLastCachedStreamingParameters(), manager.isEncrypted, withPendingRestart);
216+
}
210217
}
211218
}
212219
};

0 commit comments

Comments
 (0)