-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FFmpegReader GetAVFrame (for AV1 & async decoding) #872
Conversation
… Windows and trying to debug
…ader) - to support some types of multi-threaded video codecs (AV1)
…ws libopenshot docs
…er in FFmpegReader.
Codecov Report
@@ Coverage Diff @@
## develop #872 +/- ##
===========================================
+ Coverage 51.73% 51.88% +0.15%
===========================================
Files 187 187
Lines 16266 16328 +62
===========================================
+ Hits 8415 8472 +57
- Misses 7851 7856 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -977,7 +982,7 @@ std::shared_ptr<Frame> FFmpegReader::ReadStream(int64_t requested_frame) { | |||
|
|||
// Video packet | |||
if ((info.has_video && packet && packet->stream_index == videoStream) || | |||
(info.has_video && !packet && packet_status.video_decoded < packet_status.video_read) || | |||
(info.has_video && packet_status.video_decoded < packet_status.video_read) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call ProcessVideoPacket()
anytime video_decoded
< video_read
... so we can potentially resend a packet if needed, or try and retrieve a processed AVFrame from the decoder.
Some decoders, for example
dav1d
, process packets asynchronously and are multi-threaded. OpenShot was not correctly handling these async decoders, which resulted in dropping packets and freezing videos. This PR adds an AV1 decoding unit test as a verification, and correctly retries packets that fail to be sent to the decoder.For example, if a decoder can accept many packets before returning an AVFrame, it might also stop accepting new packets... until it's done processing the previous ones. In those cases, we need to halt getting the next packet, until we can successfully send the current packet.