| 76 | } |
| 77 | |
| 78 | bool 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 |
nothing calls this directly
no test coverage detected