MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / writeDataToOutputDevice

Method writeDataToOutputDevice

src/output/StreamThreadRtpTcp.cpp:78–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool StreamThreadRtpTcp::writeDataToOutputDevice(mpegts::PacketBuffer &buffer, StreamClient &client) {
79 // update sequence number and timestamp
80 const long timestamp = base::TimeCounter::getTicks() * 90;
81 ++_cseq;
82 buffer.tagRTPHeaderWith(_cseq, timestamp);
83
84 static constexpr size_t dataSize = buffer.getBufferSize();
85 static constexpr size_t len = dataSize + mpegts::PacketBuffer::RTP_HEADER_LEN;
86
87 // RTP packet octet count (Bytes)
88 _stream.addRtpData(dataSize, timestamp);
89
90 unsigned char header[4];
91 header[0] = 0x24;
92 header[1] = 0x00;
93 header[2] = (len >> 8) & 0xFF;
94 header[3] = (len >> 0) & 0xFF;
95
96 iovec iov[2];
97 iov[0].iov_base = header;
98 iov[0].iov_len = 4;
99 iov[1].iov_base = buffer.getReadBufferPtr();
100 iov[1].iov_len = len;
101
102 // send the RTP/TCP packet
103 if (!client.writeHttpData(iov, 2)) {
104 if (!client.isSelfDestructing()) {
105 SI_LOG_ERROR("Stream: %d, Error sending RTP/TCP Stream Data to %s", _stream.getStreamID(),
106 client.getIPAddressOfStream().c_str());
107 client.selfDestruct();
108 }
109 }
110 return true;
111}
112
113} // namespace output

Callers

nothing calls this directly

Calls 9

tagRTPHeaderWithMethod · 0.80
getBufferSizeMethod · 0.80
addRtpDataMethod · 0.80
getReadBufferPtrMethod · 0.80
writeHttpDataMethod · 0.80
isSelfDestructingMethod · 0.80
getIPAddressOfStreamMethod · 0.80
selfDestructMethod · 0.80
getStreamIDMethod · 0.45

Tested by

no test coverage detected