aboutsummaryrefslogtreecommitdiff
path: root/crypto-vala/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-12-18 22:35:32 +0100
committerMarvin W <git@larma.de>2021-12-18 22:35:32 +0100
commit474512e9d16147ec59657f8e0b9fcf6147e5e84d (patch)
treeaafb42209344278e68a38cfe39dd1370ee4a08e3 /crypto-vala/src
parent78bb2bbddaf587de77f67c404e8ed5083f16bf8a (diff)
downloaddino-474512e9d16147ec59657f8e0b9fcf6147e5e84d.tar.gz
dino-474512e9d16147ec59657f8e0b9fcf6147e5e84d.zip
SRTP: Drop unnecessary buffer copy
Diffstat (limited to 'crypto-vala/src')
-rw-r--r--crypto-vala/src/srtp.vala10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto-vala/src/srtp.vala b/crypto-vala/src/srtp.vala
index 882a8edc..22210e37 100644
--- a/crypto-vala/src/srtp.vala
+++ b/crypto-vala/src/srtp.vala
@@ -34,9 +34,8 @@ public class Session {
if (res != ErrorStatus.ok) {
throw new Error.UNKNOWN(@"SRTP encrypt failed: $res");
}
- uint8[] ret = new uint8[buf_use];
- GLib.Memory.copy(ret, buf, buf_use);
- return ret;
+ buf.length = buf_use;
+ return buf;
}
public uint8[] decrypt_rtp(uint8[] data) throws Error {
@@ -65,9 +64,8 @@ public class Session {
if (res != ErrorStatus.ok) {
throw new Error.UNKNOWN(@"SRTCP encrypt failed: $res");
}
- uint8[] ret = new uint8[buf_use];
- GLib.Memory.copy(ret, buf, buf_use);
- return ret;
+ buf.length = buf_use;
+ return buf;
}
public uint8[] decrypt_rtcp(uint8[] data) throws Error {