| 82 | } |
| 83 | |
| 84 | bool StreamThreadRtp::writeDataToOutputDevice(mpegts::PacketBuffer &buffer, StreamClient &client) { |
| 85 | // update sequence number and timestamp |
| 86 | const long timestamp = base::TimeCounter::getTicks() * 90; |
| 87 | ++_cseq; |
| 88 | buffer.tagRTPHeaderWith(_cseq, timestamp); |
| 89 | |
| 90 | static constexpr size_t dataSize = buffer.getBufferSize(); |
| 91 | static constexpr size_t len = dataSize + mpegts::PacketBuffer::RTP_HEADER_LEN; |
| 92 | |
| 93 | // RTP packet octet count (Bytes) |
| 94 | _stream.addRtpData(dataSize, timestamp); |
| 95 | |
| 96 | // send the RTP/UDP packet |
| 97 | const unsigned char *rtpBuffer = buffer.getReadBufferPtr(); |
| 98 | SocketAttr &rtp = client.getRtpSocketAttr(); |
| 99 | if (!rtp.sendDataTo(rtpBuffer, len, MSG_DONTWAIT)) { |
| 100 | if (!client.isSelfDestructing()) { |
| 101 | SI_LOG_ERROR("Stream: %d, Error sending RTP/UDP data to %s:%d", _stream.getStreamID(), |
| 102 | rtp.getIPAddressOfSocket().c_str(), rtp.getSocketPort()); |
| 103 | client.selfDestruct(); |
| 104 | } |
| 105 | } |
| 106 | return true; |
| 107 | } |
| 108 | |
| 109 | } // namespace output |
nothing calls this directly
no test coverage detected