[PATCH] libavcodec/qsvdec.c: Restoring decoding functionality after unsuccessful merge from libav.
Hello All, After commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e qsv-based decoding aborts with crash, there are many incorrect places appeared. The attached patch fixes the issues but keeps new method of the 'sync' variable allocation introduced in commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e. Please review. -- Best regards, Ivan mailto:ivan.uskov@nablet.com
Ivan Uskov <ivan.uskov <at> nablet.com> writes:
Hello All,
After commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e qsv-based
decoding
aborts with crash, there are many incorrect places appeared. The attached patch fixes the issues but keeps new method of the 'sync' variable allocation introduced in commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e.
Please review.
I had the same crashes. After reading the code, you are certainly right. Why nobody review this commit?
On 15/07/16 07:15, Chao Liu wrote:
Ivan Uskov <ivan.uskov <at> nablet.com> writes:
Hello All,
After commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e qsv-based
decoding
aborts with crash, there are many incorrect places appeared. The attached patch fixes the issues but keeps new method of the 'sync' variable allocation introduced in commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e.
Please review.
I had the same crashes. After reading the code, you are certainly right. Why nobody review this commit?
Presumably noone was particularly interested at the time, and the submitter did not pursue it. Looking at it now, the change looks mostly ok to me. The error paths could maybe be cleaned up a bit, but I think that's mostly a preexisting problem. Can we loop without *sync being set? If so, removing the av_freep(&sync); inside the loop makes it leak in that case. A slightly clearer commit message might help too. Maybe something like: --- lavc/qsvdec: Fix decoding following incorrect merge Decoding was broken by d30cf57a7b2097b565db02ecfffbdc9c16423d0e - the merge didn't properly handle the sync pointers, so it always segfaulted after submitting a frame to libmfx. --- ? - Mark
Hello Mark, Friday, July 15, 2016, 1:37:54 PM, you wrote: MT> On 15/07/16 07:15, Chao Liu wrote:
Ivan Uskov <ivan.uskov <at> nablet.com> writes:
Hello All,
After commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e qsv-based
decoding
aborts with crash, there are many incorrect places appeared. The attached patch fixes the issues but keeps new method of the 'sync' variable allocation introduced in commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e.
Please review.
I had the same crashes. After reading the code, you are certainly right. Why nobody review this commit?
MT> Presumably noone was particularly interested at the time, and the submitter did MT> not pursue it. MT> Looking at it now, the change looks mostly ok to me. The error paths could MT> maybe be cleaned up a bit, but I think that's mostly a preexisting problem. Can MT> we loop without *sync being set? If so, removing the av_freep(&sync); inside MT> the loop makes it leak in that case. MT> A slightly clearer commit message might help too. Maybe something like: MT> --- MT> lavc/qsvdec: Fix decoding following incorrect merge MT> Decoding was broken by d30cf57a7b2097b565db02ecfffbdc9c16423d0e - the MT> merge didn't properly handle the sync pointers, so it always MT> segfaulted after submitting a frame to libmfx. MT> --- If you are use qsv, I would like to recommend to roll-back to version before d30cf57a7b2097b565db02ecfffbdc9c16423d0e Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only makes code complex and work slow, the sync variable is not mandatory to be allocated on heap at all. libav guys did a big mistake when have added such "feature". -- Best regards, Ivan mailto:ivan.uskov@nablet.com
On 23/07/16 20:33, Ivan Uskov wrote:
If you are use qsv, I would like to recommend to roll-back to version before d30cf57a7b2097b565db02ecfffbdc9c16423d0e Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only makes code complex and work slow, the sync variable is not mandatory to be allocated on heap at all. libav guys did a big mistake when have added such "feature".
Are you sure that works correctly with all streams, maybe one with some sort of delay? It looks like you can add multiple things to the fifo in one call and but then only ever remove one, so using the stack to hold them across invocations is not appropriate (though failure may be very subtle). (Note that I'm not sufficiently familiar with Media SDK to confidently assert anything about how this code should behave, so please don't read too much into what I say.) In general I think if you are happy that the previous implementation in ffmpeg was correct then please do revert, because the code as it is now is completely broken. Thanks, - Mark
Hello Mark, Saturday, July 23, 2016, 11:42:46 PM, you wrote: MT> On 23/07/16 20:33, Ivan Uskov wrote:
If you are use qsv, I would like to recommend to roll-back to version before d30cf57a7b2097b565db02ecfffbdc9c16423d0e Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only makes code complex and work slow, the sync variable is not mandatory to be allocated on heap at all. libav guys did a big mistake when have added such "feature".
MT> Are you sure that works correctly with all streams, maybe one with some MT> sort of delay? It looks like you can add multiple things to the fifo in MT> one call and but then only ever remove one, so using the stack to hold MT> them across invocations is not appropriate (though failure may be very subtle). Yes, I'm sure. There are following arguments: 1. Intel's samples by itself use general variable for the 'sync' arg, not heap allocated. 2. Intel documentation says nothing special for this arg. 3. I did several qsv-based transcoders for windows and linux no any issues without this questionable trick. 4. A fifo object used previously to keep 'sync' handles already keeps data on heap :-) There only one known issue into initial implementation, the fifo size may be not enough an there is no check for overflow. So at some cases wrapper may overwrite sync entries in fifo and some decoded frames may be lost. But it is not related with discussed problem. MT> (Note that I'm not sufficiently familiar with Media SDK to confidently MT> assert anything about how this code should behave, so please don't read too much into what I say.) MT> In general I think if you are happy that the previous implementation in MT> ffmpeg was correct then please do revert, because the code as it is now is completely broken. Ok, will do. -- Best regards, Ivan mailto:ivan.uskov@nablet.com
On Sun, Jul 24, 2016 at 3:43 PM, Ivan Uskov <ivan.uskov@nablet.com> wrote:
Hello Mark,
Saturday, July 23, 2016, 11:42:46 PM, you wrote:
MT> On 23/07/16 20:33, Ivan Uskov wrote:
If you are use qsv, I would like to recommend to roll-back to version before d30cf57a7b2097b565db02ecfffbdc9c16423d0e Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only makes code complex and work slow, the sync variable is not mandatory to be allocated on heap at all. libav guys did a big mistake when have added such "feature".
MT> Are you sure that works correctly with all streams, maybe one with some MT> sort of delay? It looks like you can add multiple things to the fifo in MT> one call and but then only ever remove one, so using the stack to hold MT> them across invocations is not appropriate (though failure may be very subtle). Yes, I'm sure. There are following arguments: 1. Intel's samples by itself use general variable for the 'sync' arg, not heap allocated. 2. Intel documentation says nothing special for this arg. 3. I did several qsv-based transcoders for windows and linux no any issues without this questionable trick. 4. A fifo object used previously to keep 'sync' handles already keeps data on heap :-)
There only one known issue into initial implementation, the fifo size may be not enough an there is no check for overflow. So at some cases wrapper may overwrite sync entries in fifo and some decoded frames may be lost. But it is not related with discussed problem.
MT> (Note that I'm not sufficiently familiar with Media SDK to confidently MT> assert anything about how this code should behave, so please don't read too much into what I say.)
MT> In general I think if you are happy that the previous implementation in MT> ffmpeg was correct then please do revert, because the code as it is now is completely broken. Ok, will do.
OT: Ivan, can you *please* fix your quoting style to use standard quotes as everyone else (ie. single > for every level)? Reading your replies is practically impossible. - Hendrik
On Mon, Apr 25, 2016 at 04:13:33PM +0300, Ivan Uskov wrote:
Hello All,
After commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e qsv-based decoding aborts with crash, there are many incorrect places appeared. The attached patch fixes the issues but keeps new method of the 'sync' variable allocation introduced in commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e.
This text should be in the commit message, not just on the mailing list also some native english speaker should review/help with the grammer thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire
participants (5)
-
Chao Liu -
Hendrik Leppkes -
Ivan Uskov -
Mark Thompson -
Michael Niedermayer