Skip to content

Commit

Permalink
fixed forecast for tagged_stream_bufferer
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnavaghosh04 committed Aug 30, 2023
1 parent 21a8a81 commit 7153189
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/tagged_stream_bufferer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,24 @@ tagged_stream_bufferer_impl::~tagged_stream_bufferer_impl() {}
void tagged_stream_bufferer_impl::forecast(int noutput_items,
gr_vector_int& ninput_items_required)
{
ninput_items_required[0] = noutput_items;
int need;

switch(d_state){
case STATE_BLOCK:
case STATE_PACKET:
ninput_items_required[0] = noutput_items;
return;
case STATE_PADDING:
need = noutput_items - d_remaining_padding;
ninput_items_required[0] = need < 0 ? 0 : need;
return;
case STATE_BLOCK_UNTIL_PACKET:
case STATE_PACKET_HEADER:
case STATE_PACKET_UNTIL_TRAILER:
throw std::runtime_error("something went terribly wrong");
}


}

int tagged_stream_bufferer_impl::general_work(int noutput_items,
Expand Down

0 comments on commit 7153189

Please sign in to comment.