Jetson Multimedia API 35.1.0: encoder unit test sample failure

Running on a Jetson AGX Xavier dev kit with JetPack 5.0.2 installed and the rev.1 updates applied, I’ve installed nvidia-l4t-jetson-multimedia-api (version 35.1.0-20220825113828) and tried building and running the samples/unittest_samples/encoder_unit_sample program.

I prepared a YUV sample video using the 02_video_dec_cuda sample program on the H264 sample video included in the package. When running the encode_sample program to re-encode it back to H.264, I get:

NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
H264: Profile = 66, Level = 0 
NVMEDIA: Need to set EMC bandwidth : 846000 
NVMEDIA: Need to set EMC bandwidth : 846000 
NvMapMemCacheMaint Bad parameter
Opening in BLOCKING MODE 
nvbusurface: NvBufSurfaceSyncForCpu: Error(4) in sync
Error while queueing buffer on output plane
Got 0 size buffer in capture
Encoder is in error << endl

Running the 01_video_encode sample program on the same YUV-format sample video runs successfully:

NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
Creating Encoder in blocking mode 
Opening in BLOCKING MODE 
875967048
842091865
H264: Profile = 66, Level = 51 
NVMEDIA: Need to set EMC bandwidth : 846000 
NVMEDIA: Need to set EMC bandwidth : 846000 
NVMEDIA_ENC: bBlitMode is set to TRUE 
Could not read complete frame from input file
File read complete.
Got 0 size buffer in capture 
App run was successful

so I suspect there’s a bug in the unit test encode_sample program, but I’m not sure where.

Hi,
Please apply this patch and try again:

diff --git a/multimedia_api/ll_samples/samples/unittest_samples/encoder_unit_sample/encoder_unit_sample.cpp b/multimedia_api/ll_samples/samples/unittest_samples/encoder_unit_sample/encoder_unit_sample.cpp
index 8af65f8..58182fb 100644
--- a/multimedia_api/ll_samples/samples/unittest_samples/encoder_unit_sample/encoder_unit_sample.cpp
+++ b/multimedia_api/ll_samples/samples/unittest_samples/encoder_unit_sample/encoder_unit_sample.cpp
@@ -809,14 +809,6 @@ encoder_process_blocking(context_t& ctx)
                     break;
                 }
 
-                ret_val = NvBufSurfaceMap(nvbuf_surf, 0, j, NVBUF_MAP_READ_WRITE);
-                if (ret_val)
-                {
-                    cerr << "NvBufSurfaceMap failed\n" << endl;
-                    ctx.in_error = 1;
-                    break;
-                }
-
                 ret_val = NvBufSurfaceSyncForDevice(nvbuf_surf, 0, j);
                 if (ret_val)
                 {
@@ -824,14 +816,6 @@ encoder_process_blocking(context_t& ctx)
                     ctx.in_error = 1;
                     break;
                 }
-
-                ret_val = NvBufSurfaceUnMap(nvbuf_surf, 0, j);
-                if (ret_val)
-                {
-                    cerr << "NvBufSurfaceUnMap failed\n" << endl;
-                    ctx.in_error = 1;
-                    break;
-                }
             }
         }
 
@@ -1154,17 +1138,9 @@ int main (int argc, char const *argv[])
                 CHECK_ERROR(ret < 0,
                     "Error while NvBufSurfaceFromFd at output plane", cleanup);
 
-                ret = NvBufSurfaceMap(nvbuf_surf, 0, j, NVBUF_MAP_READ_WRITE);
-                CHECK_ERROR(ret < 0,
-                    "Error while NvBufSurfaceMap at output plane", cleanup);
-
                 ret = NvBufSurfaceSyncForDevice(nvbuf_surf, 0, j);
                 CHECK_ERROR(ret < 0,
                     "Error while NvBufSurfaceSyncForDevice at output plane", cleanup);
-
-                ret = NvBufSurfaceUnMap(nvbuf_surf, 0, j);
-                CHECK_ERROR(ret < 0,
-                    "Error while NvBufSurfaceUnMap at output plane", cleanup);
             }
         }
 
@@ -1244,7 +1220,7 @@ cleanup:
 
     if (ctx.in_error)
     {
-        cerr << "Encoder is in error << endl" << endl;
+        cerr << "Encoder is in error" << endl;
     }
 
     else

Thanks, @DaneLLL! That fixes the problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.