Skip to content

Commit

Permalink
upgrade to SRS version 1.9.0.0
Browse files Browse the repository at this point in the history
Resolves #50
  • Loading branch information
rkusa committed Jun 16, 2020
1 parent 033ab44 commit a942345
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.0.0-beta.1] - 2020-06-16
### Changed
- **Breaking:** Upgraded SRS protocol to 1.9.0.0 (requires SRS server version 1.9.x.x)

## [1.1.0] - 2020-05-24
### Changed
- Update shutdown procedure to gracefully shut down all stations instead of killing them
Expand Down
2 changes: 1 addition & 1 deletion crates/datis-cmd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "datis-cmd"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/datis-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "datis-core"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/datis-module/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "datis"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/radio-station/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dcs-radio-station"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/srs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "srs"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["rkusa"]
edition = "2018"

Expand Down
23 changes: 17 additions & 6 deletions crates/srs/src/voice_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ pub struct VoicePacket {
pub frequencies: Vec<Frequency>,
pub unit_id: u32,
pub packet_id: u64,
pub sguid: [u8; 22],
pub hop_count: u8,
pub transmission_sguid: [u8; 22],
pub client_sguid: [u8; 22],
}

impl Decoder for VoiceCodec {
Expand Down Expand Up @@ -122,9 +124,13 @@ impl Decoder for VoiceCodec {

let unit_id = rd.read_u32::<LittleEndian>()?;
let packet_id = rd.read_u64::<LittleEndian>()?;
let hop_count = rd.read_u8()?;

let mut sguid = [0; 22];
rd.read_exact(&mut sguid)?;
let mut transmission_sguid = [0; 22];
rd.read_exact(&mut transmission_sguid)?;

let mut client_sguid = [0; 22];
rd.read_exact(&mut client_sguid)?;

assert_eq!(rd.position(), len);

Expand All @@ -133,7 +139,9 @@ impl Decoder for VoiceCodec {
frequencies,
unit_id,
packet_id,
sguid,
hop_count,
transmission_sguid,
client_sguid,
})))
} else {
self.is_head = false;
Expand All @@ -154,7 +162,8 @@ impl Encoder<Packet> for VoiceCodec {
Packet::Voice(packet) => packet,
};

let capacity = 4 + packet.audio_part.len() + packet.frequencies.len() * 10 + 4 + 8 + 22;
let capacity =
4 + packet.audio_part.len() + packet.frequencies.len() * 10 + 4 + 8 + 1 + 22 + 22;
let mut wd = Cursor::new(Vec::with_capacity(capacity));

// header segment will be written at the end
Expand Down Expand Up @@ -189,7 +198,9 @@ impl Encoder<Packet> for VoiceCodec {
// - FIXED SEGMENT
wd.write_u32::<LittleEndian>(packet.unit_id)?;
wd.write_u64::<LittleEndian>(packet.packet_id)?;
wd.write_all(&packet.sguid)?;
wd.write_u8(packet.hop_count)?; // retransmission hop count
wd.write_all(&packet.transmission_sguid)?; // transmission guid
wd.write_all(&packet.client_sguid)?; // client guid

// - HEADER SEGMENT
wd.set_position(0);
Expand Down
6 changes: 4 additions & 2 deletions crates/srs/src/voice_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio::time;
use tokio_util::codec::{FramedRead, FramedWrite};
use tokio_util::udp::UdpFramed;

const SRS_VERSION: &str = "1.8.0.0";
const SRS_VERSION: &str = "1.9.0.0";

pub struct VoiceStream {
voice_sink: mpsc::Sender<Packet>,
Expand Down Expand Up @@ -252,7 +252,9 @@ impl Sink<Vec<u8>> for VoiceStream {
}],
unit_id: self.client.unit().map(|u| u.id).unwrap_or(0),
packet_id: self.packet_id,
sguid,
hop_count: 0,
transmission_sguid: sguid,
client_sguid: sguid,
};

let s = self.get_mut();
Expand Down
2 changes: 1 addition & 1 deletion crates/win-media/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "win-media"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/win-tts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "win-tts"
version = "1.1.0"
version = "2.0.0-beta.1"
authors = ["Markus Ast <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion mod/Mods/tech/DATIS/entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare_plugin("DATIS", {
"datis.dll",
},

version = "1.1.0",
version = "2.0.0-beta.1",
state = "installed",
developerName = "github.com/rkusa",
info = _("DATIS enables a DCS server with an SRS server running on the same machine (TCP=127.0.0.1) to get weather from the mission for stations and frequencies set in the mission editor, and then to report same in a standardized format over SRS using either the Amazon or Google text to speech engines."),
Expand Down

0 comments on commit a942345

Please sign in to comment.