diff options
Diffstat (limited to 'telecomm/java/android/telecom/VideoCallImpl.java')
| -rw-r--r-- | telecomm/java/android/telecom/VideoCallImpl.java | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index 925058e..3779d1a 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -42,10 +42,11 @@ public class VideoCallImpl extends VideoCall { private static final int MSG_CHANGE_PEER_DIMENSIONS = 4; private static final int MSG_CHANGE_CALL_DATA_USAGE = 5; private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6; + private static final int MSG_CHANGE_VIDEO_QUALITY = 7; private final IVideoProvider mVideoProvider; private final VideoCallListenerBinder mBinder; - private VideoCall.Listener mVideoCallListener; + private VideoCall.Callback mCallback; private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { @Override @@ -88,7 +89,12 @@ public class VideoCallImpl extends VideoCall { } @Override - public void changeCallDataUsage(int dataUsage) { + public void changeVideoQuality(int videoQuality) { + mHandler.obtainMessage(MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0).sendToTarget(); + } + + @Override + public void changeCallDataUsage(long dataUsage) { mHandler.obtainMessage(MSG_CHANGE_CALL_DATA_USAGE, dataUsage).sendToTarget(); } @@ -103,14 +109,14 @@ public class VideoCallImpl extends VideoCall { private final Handler mHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { - if (mVideoCallListener == null) { + if (mCallback == null) { return; } SomeArgs args; switch (msg.what) { case MSG_RECEIVE_SESSION_MODIFY_REQUEST: - mVideoCallListener.onSessionModifyRequestReceived((VideoProfile) msg.obj); + mCallback.onSessionModifyRequestReceived((VideoProfile) msg.obj); break; case MSG_RECEIVE_SESSION_MODIFY_RESPONSE: args = (SomeArgs) msg.obj; @@ -119,32 +125,35 @@ public class VideoCallImpl extends VideoCall { VideoProfile requestProfile = (VideoProfile) args.arg2; VideoProfile responseProfile = (VideoProfile) args.arg3; - mVideoCallListener.onSessionModifyResponseReceived( + mCallback.onSessionModifyResponseReceived( status, requestProfile, responseProfile); } finally { args.recycle(); } break; case MSG_HANDLE_CALL_SESSION_EVENT: - mVideoCallListener.onCallSessionEvent((int) msg.obj); + mCallback.onCallSessionEvent((int) msg.obj); break; case MSG_CHANGE_PEER_DIMENSIONS: args = (SomeArgs) msg.obj; try { int width = (int) args.arg1; int height = (int) args.arg2; - mVideoCallListener.onPeerDimensionsChanged(width, height); + mCallback.onPeerDimensionsChanged(width, height); } finally { args.recycle(); } break; case MSG_CHANGE_CALL_DATA_USAGE: - mVideoCallListener.onCallDataUsageChanged(msg.arg1); + mCallback.onCallDataUsageChanged((long) msg.obj); break; case MSG_CHANGE_CAMERA_CAPABILITIES: - mVideoCallListener.onCameraCapabilitiesChanged( + mCallback.onCameraCapabilitiesChanged( (CameraCapabilities) msg.obj); break; + case MSG_CHANGE_VIDEO_QUALITY: + mCallback.onVideoQualityChanged(msg.arg1); + break; default: break; } @@ -157,12 +166,21 @@ public class VideoCallImpl extends VideoCall { mVideoProvider.asBinder().linkToDeath(mDeathRecipient, 0); mBinder = new VideoCallListenerBinder(); - mVideoProvider.setVideoCallback(mBinder); + mVideoProvider.addVideoCallback(mBinder); + } + + /** {@inheritDoc} */ + public void registerCallback(VideoCall.Callback callback) { + mCallback = callback; } /** {@inheritDoc} */ - public void setVideoCallListener(VideoCall.Listener videoCallListener) { - mVideoCallListener = videoCallListener; + public void unregisterCallback() { + mCallback = null; + try { + mVideoProvider.removeVideoCallback(mBinder); + } catch (RemoteException e) { + } } /** {@inheritDoc} */ @@ -244,4 +262,4 @@ public class VideoCallImpl extends VideoCall { } catch (RemoteException e) { } } -}
\ No newline at end of file +} |
