Search in sources :

Example 1 with Data

use of org.thoughtcrime.securesms.webrtc.WebRtcDataProtos.Data in project Signal-Android by WhisperSystems.

the class WebRtcCallService method onMessage.

@Override
public void onMessage(DataChannel.Buffer buffer) {
    Log.w(TAG, "onMessage...");
    try {
        byte[] data = new byte[buffer.data.remaining()];
        buffer.data.get(data);
        Data dataMessage = Data.parseFrom(data);
        if (dataMessage.hasConnected()) {
            Log.w(TAG, "hasConnected...");
            Intent intent = new Intent(this, WebRtcCallService.class);
            intent.setAction(ACTION_CALL_CONNECTED);
            intent.putExtra(EXTRA_CALL_ID, dataMessage.getConnected().getId());
            startService(intent);
        } else if (dataMessage.hasHangup()) {
            Log.w(TAG, "hasHangup...");
            Intent intent = new Intent(this, WebRtcCallService.class);
            intent.setAction(ACTION_REMOTE_HANGUP);
            intent.putExtra(EXTRA_CALL_ID, dataMessage.getHangup().getId());
            startService(intent);
        } else if (dataMessage.hasVideoStreamingStatus()) {
            Log.w(TAG, "hasVideoStreamingStatus...");
            Intent intent = new Intent(this, WebRtcCallService.class);
            intent.setAction(ACTION_REMOTE_VIDEO_MUTE);
            intent.putExtra(EXTRA_CALL_ID, dataMessage.getVideoStreamingStatus().getId());
            intent.putExtra(EXTRA_MUTE, !dataMessage.getVideoStreamingStatus().getEnabled());
            startService(intent);
        }
    } catch (InvalidProtocolBufferException e) {
        Log.w(TAG, e);
    }
}
Also used : InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) Data(org.thoughtcrime.securesms.webrtc.WebRtcDataProtos.Data) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Data (org.thoughtcrime.securesms.webrtc.WebRtcDataProtos.Data)1