syntax = "proto3";

package openspeak.v1;

option go_package = "github.com/sorti/openspeak/pkg/api/openspeak/v1";

service VoiceService {
  rpc PublishVoiceStream(stream VoicePacket) returns (stream PublishVoiceResponse);
  rpc SubscribeVoiceStream(SubscribeVoiceRequest) returns (stream VoicePacket);
}

message VoicePacket {
  string source_user_id = 1;
  string channel_id = 2;
  uint32 sequence_number = 3;
  uint32 timestamp = 4;
  uint32 ssrc = 5;
  bytes payload = 6;
  int32 payload_length = 7;
  int64 client_timestamp = 8;
}

message PublishVoiceResponse {
  bool success = 1;
  string error_message = 2;
  uint32 last_received_sequence = 3;
}

message SubscribeVoiceRequest {
  string channel_id = 1;
}
