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

Amazon Kinesis Video Streams parser library is for developers to include in their applications that makes it easy to work with the output of video streams such as retrieving frame-level objects, metadata for fragments, and more.
Apache License 2.0
103 stars 52 forks source link

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

Closed GilShalev2017 closed 4 years ago

GilShalev2017 commented 4 years ago

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?

MushMal commented 4 years ago

@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

bdhandap commented 4 years ago

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.

https://github.com/aws/amazon-kinesis-video-streams-parser-library/blob/b72c4d82a1856ad66cb74430f82dcdbfce5dabe2/src/main/java/com/amazonaws/kinesisvideo/parser/ebml/EBMLParser.java#L197-L198

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

https://github.com/aws/amazon-kinesis-video-streams-parser-library/blob/b72c4d82a1856ad66cb74430f82dcdbfce5dabe2/src/main/java/com/amazonaws/kinesisvideo/parser/mkv/StreamingMkvReader.java#L139-L141

MushMal commented 4 years ago

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