Commit 4d495c98 authored by Aline Gondim Santos's avatar Aline Gondim Santos

disable hardwareacceleration once mediahandler is toggled

Change-Id: I8ab845df0ade6875e2c1fbcc017ab3593f6b29b7
parent 942e6d1b
......@@ -1415,8 +1415,8 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
// If a call media handler doesn't have an icon use a standard android icon
for (String callMediaHandler : callMediaHandlers) {
Map<String, String> details = getCallMediaHandlerDetails(callMediaHandler);
String drawablePath = details.get("icoPath");
Drawable handlerIcon = StringUtils.isEmpty(drawablePath) ? null : Drawable.createFromPath(details.get("icoPath"));
String drawablePath = details.get("iconPath");
Drawable handlerIcon = StringUtils.isEmpty(drawablePath) ? null : Drawable.createFromPath(details.get("iconPath"));
if (handlerIcon == null) {
handlerIcon = context.getDrawable(R.drawable.ic_jami);
}
......@@ -1429,8 +1429,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
}
if (choosePluginMode) {
//change preview image
displayVideoSurface(true,true);
// hide hang up button and other call buttons
displayHangupButton(false);
// Display the plugins recyclerpicker
......@@ -1450,13 +1448,12 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
}
if (position > 0) {
String callMediaId = callMediaHandlers.get(position-1);
toggleCallMediaHandler(callMediaId, true);
presenter.startPlugin(callMediaId);
//toggleCallMediaHandler(callMediaId, true);
}
}
} else {
//change preview image
displayVideoSurface(true,true);
if (previousPluginPosition > 0) {
String callMediaId = callMediaHandlers.
get(previousPluginPosition-1);
......@@ -1464,10 +1461,14 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
toggleCallMediaHandler(callMediaId, false);
rp.scrollToPosition(previousPluginPosition);
}
presenter.stopPlugin();
binding.recyclerPicker.setVisibility(View.GONE);
movePreview(false);
displayHangupButton(true);
}
//change preview image
displayVideoSurface(true,true);
}
/**
......
......@@ -58,6 +58,8 @@ import cx.ring.utils.Log;
import cx.ring.utils.Ringer;
import io.reactivex.Completable;
import static cx.ring.daemon.RingserviceJNI.toggleCallMediaHandler;
public class HardwareServiceImpl extends HardwareService implements AudioManager.OnAudioFocusChangeListener, BluetoothWrapper.BluetoothChangeListener {
private static final Point VIDEO_SIZE_LOW = new Point(320, 240);
......@@ -86,6 +88,8 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
private boolean mShouldCapture = false;
private boolean mShouldSpeakerphone = false;
private final boolean mHasSpeakerPhone;
private boolean mIsChoosePlugin = false;
private String mMediaHandlerId;
public HardwareServiceImpl(Context context) {
mContext = context;
......@@ -478,6 +482,20 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
}
}
public void startMediaHandler(String mediaHandlerId) {
mIsChoosePlugin = true;
mMediaHandlerId = mediaHandlerId;
}
private void toggleMediaHandler() {
toggleCallMediaHandler(mMediaHandlerId, true);
}
public void stopMediaHandler() {
mIsChoosePlugin = false;
mMediaHandlerId = "";
}
@Override
public void startCapture(@Nullable String camId) {
if (mIsScreenSharing) {
......@@ -506,7 +524,7 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
return;
}
final Conference conf = mCameraPreviewCall.get();
boolean useHardwareCodec = mPreferenceService.isHardwareAccelerationEnabled() && (conf == null || !conf.isConference());
boolean useHardwareCodec = mPreferenceService.isHardwareAccelerationEnabled() && (conf == null || !conf.isConference()) && !mIsChoosePlugin;
if (conf != null && useHardwareCodec) {
SipCall call = conf.getCall();
if (call != null) {
......@@ -526,6 +544,8 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
new CameraService.CameraListener() {
@Override
public void onOpened() {
if(mIsChoosePlugin && !mMediaHandlerId.isEmpty())
toggleMediaHandler();
}
@Override
......
......@@ -720,4 +720,18 @@ public class CallPresenter extends RootPresenter<CallView> {
public boolean isMaximized(SipCall call) {
return mConference.getMaximizedCall() == call;
}
public void startPlugin(String mediaHandlerId) {
mHardwareService.startMediaHandler(mediaHandlerId);
if(mConference == null)
return;
mHardwareService.switchInput(mConference.getId(), mHardwareService.isPreviewFromFrontCamera());
}
public void stopPlugin() {
mHardwareService.stopMediaHandler();
if(mConference == null)
return;
mHardwareService.switchInput(mConference.getId(), mHardwareService.isPreviewFromFrontCamera());
}
}
......@@ -163,6 +163,10 @@ public abstract class HardwareService {
public abstract void unregisterCameraDetectionCallback();
public abstract void startMediaHandler(String mediaHandlerId);
public abstract void stopMediaHandler();
public void connectivityChanged(boolean isConnected) {
Log.i(TAG, "connectivityChange() " + isConnected);
connectivityEvents.onNext(isConnected);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment