[vlc-commits] qsv: simplify busy loop

Rafaël Carré git at videolan.org
Wed Jun 12 12:57:41 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Jun 12 12:56:57 2013 +0200| [2ff975295dc438c6a12721941959800726d8fe58] | committer: Rafaël Carré

qsv: simplify busy loop

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ff975295dc438c6a12721941959800726d8fe58
---

 modules/codec/qsv.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index 193273c..30e4fa2 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -723,12 +723,13 @@ static block_t *Encode(encoder_t *this, picture_t *pic)
     task->bs.MaxLength = sys->params.mfx.BufferSizeInKB * 1000;
     task->bs.Data = task->block->p_buffer;
 
-    sts = MFXVideoENCODE_EncodeFrameAsync(sys->session, 0, frame, &task->bs, &task->syncp);
-    while (sts == MFX_WRN_DEVICE_BUSY) {
+    for (;;) {
+        sts = MFXVideoENCODE_EncodeFrameAsync(sys->session, 0, frame, &task->bs, &task->syncp);
+        if (sts != MFX_WRN_DEVICE_BUSY)
+            break;
         if (sys->busy_warn_counter++ % 16 == 0)
             msg_Dbg(enc, "Device is busy, let's wait and retry");
         msleep(QSV_BUSYWAIT_TIME);
-        sts = MFXVideoENCODE_EncodeFrameAsync(sys->session, 0, frame, &task->bs, &task->syncp);
     }
 
     // msg_Dbg(enc, "Encode async status: %d, Syncpoint = %tx", sts, (ptrdiff_t)task->syncp);



More information about the vlc-commits mailing list