Bug fix for multi channel audio Signal#1992
Bug fix for multi channel audio Signal#1992Kjos wants to merge 4 commits intoaccord-net:developmentfrom
Conversation
Null will be returned when stream has finished. However with BitmapData null was not passed through. Checking on framecounter alone can lead to issues, so Bitmap should be returned even when using BitmapData.
Sample size was incorrect when Signal.channels was not 1.
The got_packet checks fails consistently at start when encoding with the H264 encoder. When this happens, the same frame is encoded several times avcodec_encode_video2. This will result in duplicated frames at start of the output video, as well as the error message "non monotonic PTS" for the first couple of frames. Some more research might be required in how got_packet should be handled, however as I am experiencing myself, removing the check works better than leaving it (as the audio codec doesn't have this problem, audio and video will be unaligned)
|
Added got_packet check removal which was messing with PTS consistency |
|
My hypothesis what seems to be happening with the got_packet check and the H264 encoder; it seems to be filling the buffer the first few frames and not wanting to spit out frames to the video file, as when got_packet check is removed, it will spit out frames but the end of the video will have frames missing (which are most likely still in the buffer, about 1 second regardless of video length). |
Flushes successfully for H264 video.
|
Added flushing. Tested with H264 video, seems to work fine. Might need to be moved to VideoFileWriter::Flush, but IMHO it's better in Close. |
Please disregard the changes to VideoFileReader. I'm pushing this from within Github and don't have the option to selectively create a PR.
The change in VideoFileWriter fixes a bug where sending a multi channel (2+) Signal will create noise as output. Since the unit test sends a 1 channel Signal to the video file, this wasn't caught.