Skip to content

Commit

Permalink
Call compute() upon encoder creation
Browse files Browse the repository at this point in the history
This is not done automatically, but is required when using the RFC
version of libRaptorQ.
  • Loading branch information
Eugene Kim committed Dec 7, 2018
1 parent cbee330 commit 5459ed8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/impl/libraptorq/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type EncoderFactory struct {

func (*EncoderFactory) New(input []byte, symbolSize uint16, minSubSymbolSize uint16,
maxSubBlockSize uint32, alignment uint8) (enc raptorq.Encoder, err error) {
wrapped := swig.NewBytesEncoder(input, minSubSymbolSize, symbolSize,
wrapped := swig.InitBytesEncoder(input, minSubSymbolSize, symbolSize,
int64(maxSubBlockSize))
if !wrapped.Initialized() {
swig.DeleteBytesEncoder(wrapped)
Expand Down
17 changes: 17 additions & 0 deletions pkg/impl/libraptorq/swig/swig.swigcxx
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,20 @@ public:

%template(BytesEncoder) RFC6330__v1::Impl::Encoder<unsigned char *, unsigned char *>;
%template(BytesDecoder) RFC6330__v1::Impl::Decoder<unsigned char *, unsigned char *>;

%inline %{

typedef RFC6330__v1::Impl::Encoder<unsigned char *, unsigned char *> BytesEncoder;

BytesEncoder *InitBytesEncoder(
unsigned char *SLICEBEGIN, unsigned char *SLICEEND,
uint16_t min_subsymbol_size, uint16_t symbol_size, size_t max_sub_block
) {
auto enc = new BytesEncoder(
SLICEBEGIN, SLICEEND, min_subsymbol_size, symbol_size, max_sub_block
);
enc->compute(RaptorQ__v1::Compute::COMPLETE | RaptorQ__v1::Compute::NO_BACKGROUND);
return enc;
}

%}

0 comments on commit 5459ed8

Please sign in to comment.