Commit Graph

1831 Commits

Author SHA1 Message Date
Aaro Altonen 65adaa3a09 Increase the maximum payload size 2019-07-30 08:21:28 +03:00
Aaro Altonen 6c82f375de Update RTP session statistics for each send() 2019-07-30 07:36:33 +03:00
Aaro Altonen b16956d953 Update RTP sequence after each send
While there, disable the linux frame queue implementation for now.
I need think of a way to store a unique RTP sequence for each buffer
2019-07-27 09:17:22 +03:00
Aaro Altonen b5d07cc0eb Create function for updating RTP sequence of an RTP header buffer 2019-07-26 10:52:34 +03:00
Aaro Altonen 516bb70c8b Add license 2019-07-26 09:29:04 +03:00
Aaro Altonen 6caf52564a Update readme 2019-07-26 09:28:47 +03:00
Aaro Altonen 5292ffbec5 Move NTP and high-resolution clock to separate namespace
This makes the code look cleaner as now function names don't contain
information about the clock type.
2019-07-25 08:35:53 +03:00
Aaro Altonen f5bc6bb350 Remove useless warning 2019-07-24 12:23:14 +03:00
Aaro Altonen fb8d4a0397 Use the new send API on Windows 2019-07-24 10:18:37 +03:00
Aaro Altonen 291533b9ef Deallocate CSRC entries 2019-07-24 10:04:34 +03:00
Aaro Altonen 22a9deb222 Improve how incoming RTP frames are handled
Make sure that header is correct, copy the CSRCs if present, and
make sure padding is discarded if the frame has been padded

Extension checking missing
2019-07-24 10:04:09 +03:00
Aaro Altonen 839285b0dd Create new RTP Frame structure with separate header field 2019-07-24 09:51:26 +03:00
Aaro Altonen fa1c82fb0f Make sure the received RTP frame is valid 2019-07-23 09:06:47 +03:00
Aaro Altonen 46e0842d1f Save the outgoing address to private variable in queue.cc
This fixes the bug where outgoing address was saved to stack and
the msg_name pointer pointed to garbage when flush_queue() was called
2019-07-23 08:49:49 +03:00
Aaro Altonen 8760bd97ce Initially set the wall clock start to 0 2019-07-23 08:47:41 +03:00
Aaro Altonen 138d7e8271 Remove some warnings 2019-07-23 08:19:35 +03:00
Aaro Altonen 37d8ee9f1a Include RTP header size to frame total length 2019-07-22 09:26:11 +03:00
Aaro Altonen 942e6ce05c Send correct buffers in __sendtov() 2019-07-19 09:32:54 +03:00
Aaro Altonen 0ed923e5a0 Implement frame queue for windows
This isn't quite optimal solution just yet. All copying should be
deleted but that requires some extensive studying of the winsock
documentation and it has to do for now
2019-07-19 09:31:07 +03:00
Aaro Altonen 6b89c779d7 Create new send API
This API is used to send small messages. The message may consist of
several smaller buffers or it may just be one buffer containing all the
data.

The total size of buffers must not exceed the MAX_PAYLOAD limit
2019-07-18 12:11:15 +03:00
Aaro Altonen 9484444699 Create routines for sending multiple buffers at once
This is very similar to using frame queue but if there's no need for
caching the frames ie. all the needed buffers are ready, it easier to use these
functions than to enqeueu and then flush the queue
2019-07-18 11:55:21 +03:00
Aaro Altonen 07e2d822cf Add Winsock-related cleanup stuff 2019-07-16 11:47:58 +03:00
Aaro Altonen 4e54a0a8d2 Create helper function for printing the latest error on Windows 2019-07-16 11:43:38 +03:00
Aaro Altonen b919574be9 Use WSASendTo instead of WSASend
Because we're using unconnected sockets, the destination must be
defined explicitly
2019-07-16 11:37:17 +03:00
Aaro Altonen ec8619864e Disable ANSI colors on Windows 2019-07-16 10:37:18 +03:00
Aaro Altonen 4fe5b38caf Update library instructions 2019-07-16 10:14:01 +03:00
Aaro Altonen 466b8921fa Add staticlib to Qt project config
Without this the library didn't work quite well on Windows
2019-07-16 10:08:30 +03:00
Aaro Altonen 9fcf8b5a76 Implement windows-specific parts 2019-07-15 12:06:38 +03:00
Aaro Altonen b45774e5ee Add missing files to Qt project file 2019-07-15 11:02:29 +03:00
Aaro Altonen 0f9111df7d Fix IP family assert in socket.cc 2019-07-15 10:57:35 +03:00
Aaro Altonen d5bdc0c62c Create frame queue for sending fragmented frames
This queue is used to send large frame (f.ex. HEVC frames) where the
frame must be split into smaller fragments. As an optimization,
the fragments are saved into message buffers and when the last fragment
has been extracted from the frame, the whole message buffer is flushed at
once. This cuts down the amount of system calls to 1 per frame and
removes all unnecessary copies.

Winsock implementation missing
2019-07-15 10:16:31 +03:00
Aaro Altonen 8168652acf Generate random SSRC for each connection
Required by the spec
2019-07-15 09:29:02 +03:00
Aaro Altonen 3cff82e132 Create function generating random 32-bit numbers 2019-07-15 09:29:02 +03:00
Aaro Altonen 861f2e8eb2 Create only one CNAME for the session
According to spec, CNAME should be the same for all connections of participant
2019-07-15 09:01:00 +03:00
Aaro Altonen bd3bc12aaa Return reference to socket instead of copy of it
After each call the desctructor of socket was called which closed
the actual socket and all subsequent calls failed.
2019-07-15 08:04:24 +03:00
Aaro Altonen bc98e6cdbe Save the outgoing address by default to socket.cc 2019-06-28 11:36:18 +03:00
Aaro Altonen 118b75dd9b Check the validity of RTCP before calling it
RTCP is optional and thus may be nullptr
2019-06-28 11:36:15 +03:00
Aaro Altonen 95e911508a Calculate interarrival jitter for incoming RTP packets 2019-06-28 10:54:44 +03:00
Aaro Altonen 746bf2c2e7 Create private clock for each RTCP session participant
We need to create a separate clock (in RTP timestamp units) for each
participant to calculate the interarrival jitter of RTP packets correctly
2019-06-28 10:35:46 +03:00
Aaro Altonen f32b8464cf Create clock related utilies 2019-06-28 10:32:24 +03:00
Aaro Altonen ee2da80dde Generate random 32-bit starting value for RTP sequence
Required by the spec
2019-06-27 11:55:39 +03:00
Aaro Altonen e524ffbc10 Calculate correct RTP timestamp for Sender Reports 2019-06-27 10:56:19 +03:00
Aaro Altonen da6609c571 Calculate delay since last SR block for RR blocks 2019-06-27 10:54:42 +03:00
Aaro Altonen a946ffcb2a Give the timestamp info after the first RTP packet to RTCP
Previously the information was given too early which meant that
RTCP used incorrect information when calculating the RTP timestamps
for RTCP Sender Reports
2019-06-27 09:33:46 +03:00
Aaro Altonen 52fccc96fa Send Sender Reports to all participant
The code erroneously send the reports to other senders only
2019-06-27 08:58:06 +03:00
Aaro Altonen 2d210ea6cd Send RTCP status reports every 5 seconds
5 seconds is the mimimum interval betwen RTCP packets required by
the spec. Some time in the future a better scheduling algorithm
will be implemented for RTCP reports
2019-06-27 08:53:43 +03:00
Aaro Altonen 96ff8b6d4f Give correct RTCP payload type for Sender Reports 2019-06-27 08:20:03 +03:00
Aaro Altonen 0b80d87d33 Give RTCP initial NTP and RTP timestamps + clock rate
These values are for calculating timestamps for Sender Reports
2019-06-26 12:43:36 +03:00
Aaro Altonen f19fdbda7b Calculate RTP timestamp properly
Generating NTP and random RTP timestamp allows us to sync different
media streams and provide useful RTP timestamps for RTCP Sender Reports
2019-06-26 12:32:08 +03:00
Aaro Altonen 00bca33585 Add clock_rate_ variable for RTP timestamp calculations
Clock rate varies based on the the media sent and it's used to
calculate the RTP timestamp from t = 0 time
2019-06-26 12:30:17 +03:00