aws/amazon-kinesis-video-streams-parser-library

Can a frame visitor's process method be called even if parser library is throwing an exception

GilShalev2017 opened this issue · 3 comments

I'm using the parser library, and catching the following exceptions: (all related to partial frame data)

1). java.lang.IllegalArgumentException: A non-master element should not have unknown length
2). java.lang.IllegalArgumentException: Trying to decode an EBML ID and it wants 8 more bytes, but IDs max out at 4 bytes. firstByte was 0
3). java.lang.IllegalArgumentException: Cannot skip element of unknown length

My question is can the FrameVisitor.FrameProcessor process() method still be called with a partial frame, although an exception was raised?

@GilShalev2017 thanks for the post. I tried to verify the negative path and it does seem that an exception will tear down the stack and no callbacks will be made. The codebase is single threaded in that nature. I am going to ask someone else from the team who has more familiarity with it to comment if they have more details

My question is can the FrameVisitor.FrameProcessor process() method still be called with a partial frame, although an exception was raised?

@GilShalev2017 It shouldn't. For example "A non-master element should not have unknown length" error occurs when there is any EBML element which should have mandatory length contains unknown length -1.

Validate.isTrue(!currentElement.isUnknownLength(),
"A non-master element should not have unknown length");

When this exception is thrown it will be propagated to StreamingMkvReader which will skip calling accept and throw the exception to caller.

Optional<MkvElement> mkvElementOptional = this.nextIfAvailable();
if (mkvElementOptional.isPresent()) {
mkvElementOptional.get().accept(visitor);

I am resolving this issue due to it being stale (last response was two weeks back)