MCPcopy Create free account
hub / github.com/Haivision/srt / Read

Method Read

apps/transmitmedia.cpp:1123–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121 }
1122
1123 int Read(size_t chunk, MediaPacket& pkt, ostream & ignored SRT_ATR_UNUSED = cout) override
1124 {
1125 const int length = UdpSource::Read(chunk, pkt);
1126
1127 if (length < 1 || !bytes_to_skip)
1128 {
1129 // something went wrong, or we're not skipping bytes for some
1130 // reason, just return the length read via the base method
1131 return length;
1132 }
1133
1134 // we got some data and we're supposed to skip some of it
1135 // check there's enough bytes for our intended skip
1136 if (length < bytes_to_skip)
1137 {
1138 // something went wrong here
1139 cerr << "RTP packet too short (" << length
1140 << " bytes) to remove headers (needed "
1141 << bytes_to_skip << ")" << endl;
1142 throw std::runtime_error("Unexpected RTP packet length");
1143 }
1144
1145 pkt.payload.erase(
1146 pkt.payload.begin(),
1147 pkt.payload.begin() + bytes_to_skip
1148 );
1149
1150 return length - bytes_to_skip;
1151 }
1152};
1153
1154class RtpTarget : public UdpTarget {

Callers

nothing calls this directly

Calls 3

ReadFunction · 0.85
eraseMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected