MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / buffer_and_forward

Method buffer_and_forward

OpenHD/ohd_video/src/openhd_rtp.cpp:158–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void openhd::RTPFragmentBuffer::buffer_and_forward(
159 std::shared_ptr<std::vector<uint8_t>> fragment, uint64_t dts) {
160 m_frame_fragments.push_back(fragment);
161 openhd::rtp_eof_helper::RTPFragmentInfo info{};
162 if (m_is_h265) {
163 info = openhd::rtp_eof_helper::h265_more_info(fragment->data(),
164 fragment->size());
165 } else {
166 info = openhd::rtp_eof_helper::h264_more_info(fragment->data(),
167 fragment->size());
168 }
169 if (info.is_fu_start) {
170 if (is_idr_frame(info.nal_unit_type, m_is_h265)) {
171 m_last_fu_s_idr = true;
172 } else {
173 m_last_fu_s_idr = false;
174 }
175 }
176 // m_console->debug("Fragment {} start:{} end:{}
177 // type:{}",m_frame_fragments.size(),
178 // OHDUtil::yes_or_no(info.is_fu_start),
179 // OHDUtil::yes_or_no(info.is_fu_end),
180 // x_get_nal_unit_type_as_string(info.nal_unit_type,is_h265));
181 bool is_last_fragment_of_frame = info.is_fu_end;
182 if (m_frame_fragments.size() > 500) {
183 // Most likely something wrong with the "find end of frame" workaround
184 m_console->debug("No end of frame found after 1000 fragments");
185 is_last_fragment_of_frame = true;
186 }
187 if (is_last_fragment_of_frame) {
188 on_new_rtp_fragmented_frame();
189 m_frame_fragments.resize(0);
190 m_last_fu_s_idr = false;
191 }
192}
193
194void openhd::RTPFragmentBuffer::on_new_rtp_fragmented_frame() {
195 const bool is_intra_frame = m_last_fu_s_idr;

Callers

nothing calls this directly

Calls 4

is_idr_frameFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.80
debugMethod · 0.80

Tested by

no test coverage detected