Transcoder icon indicating copy to clipboard operation
Transcoder copied to clipboard

add do not sleep wait state

Open jumperson opened this issue 3 years ago • 2 comments

notice: #170 should be merged before merging this PR.

I added State.wait which doesn't call sleep.

There are cases in State.wait where it is not necessary to call Thread.sleep .

For example https://github.com/natario1/Transcoder/blob/main/lib/src/main/java/com/otaliastudios/transcoder/internal/codec/Decoder.kt#L120

Call Thread.sleep in State.wait slows down the process when trimming the beginning ref: #169

jumperson avatar Feb 10 '22 08:02 jumperson

Thanks @jumperson , I like the idea but how are you deciding when to use Wait(false) or Wait(true)? I don't see a pattern. Also I wonder if some of these Wait(false) could just be Retry.

natario1 avatar Mar 12 '22 14:03 natario1

@natario1 Thanks for reply. I think the default behavior is Wait(false) . This is because even in the case of Wait, MediaExtractor.advance () is called and the state changes. I think to call Thread.sleep is good only for if the document can read that Sleep is needed, such as INFO_TRY_AGAIN_LATER.

jumperson avatar Mar 16 '22 09:03 jumperson