diff options
author | Nao Pross <np@0hm.ch> | 2021-11-22 16:06:33 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2021-11-22 16:06:33 +0100 |
commit | e0b36bbddfa7e7f0c259ee82c220aee425a058a6 (patch) | |
tree | 070ad0822dc8864bd6c2cd1c1ec228fad38dd653 | |
parent | Draw packet (diff) | |
download | Fading-e0b36bbddfa7e7f0c259ee82c220aee425a058a6.tar.gz Fading-e0b36bbddfa7e7f0c259ee82c220aee425a058a6.zip |
Fix buffer crash
-rw-r--r-- | src/gr-fadingui/python/datasource.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gr-fadingui/python/datasource.py b/src/gr-fadingui/python/datasource.py index 69a2122..12573a8 100644 --- a/src/gr-fadingui/python/datasource.py +++ b/src/gr-fadingui/python/datasource.py @@ -35,27 +35,27 @@ class datasource(gr.basic_block): # a frame has 5 id bits so, there can only be 2 ** 5 chunks per file # see docstring of frame_obj for more details nblocks = int(self.fsize / self.frame.payload_length) - log.debug(f"Loaded {self.fsize} bytes = {nblocks} blocks from name={self.fname}") + log.debug(f"Loaded {self.fsize} bytes = {nblocks} blocks from {self.fname}") assert nblocks < 2 ** 5, "Payload size too small or file too big" self.fpos = 0 self.blocknr = 0 - # would have been nice to have but does not work - # self.set_min_noutput_items(frame_obj.length) + # Ensure that output buffer is always at least as big a one frame + # This probably hits the performance of the simulation quite badly, + # it would be better to implement buffering (see below) + self.set_output_multiple(self.frame.length) - # FIXME: implement buffering - # output buffer + # FIXME: Implement buffering if the GR algorithm gives a smaller output + # buffer. This is partially solved with the previous line. self.outbuffer = np.array([]) def general_work(self, input_items, output_items): out = output_items[0] - # FIXME: if there is leftover buffer add that first - # if self.outbuffer.size > 0: - # log.debug("Frame did not fit into buffer") - # out[:len(self.outbuffer)] = self.outbuffer + if self.outbuffer.size > 0: + log.warning("Frame did not fit into buffer") if self.fpos + self.frame.payload_length > self.fsize: # FIXME: implement edge case |