@ -2149,7 +2149,7 @@ describe(MediaService.name, () => {
'-map 0:1' ,
'-g 256' ,
'-v verbose' ,
'-vf scale_rkrga=-2:720:format=nv12:afbc=1 ',
'-vf scale_rkrga=-2:720:format=nv12:afbc=1 :async_depth=4 ',
'-level 51' ,
'-rc_mode CQP' ,
'-qp_init 23' ,
@ -2220,7 +2220,7 @@ describe(MediaService.name, () => {
inputOptions : expect.arrayContaining ( [ '-hwaccel rkmpp' , '-hwaccel_output_format drm_prime' , '-afbc rga' ] ) ,
outputOptions : expect.arrayContaining ( [
expect . stringContaining (
'scale_rkrga=-2:720:format=p010:afbc=1 ,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:r=pc:p=bt709:t=bt709:m=bt709:tonemap=hable:desat=0:tonemap_mode=lum:peak=100,hwmap=derive_device=rkmpp:mode=write:reverse=1,format=drm_prime',
'scale_rkrga=-2:720:format=p010:afbc=1 :async_depth=4 ,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:r=pc:p=bt709:t=bt709:m=bt709:tonemap=hable:desat=0:tonemap_mode=lum:peak=100,hwmap=derive_device=rkmpp:mode=write:reverse=1,format=drm_prime',
) ,
] ) ,
twoPass : false ,
@ -2228,6 +2228,28 @@ describe(MediaService.name, () => {
) ;
} ) ;
it ( 'should set hardware decoding options for rkmpp when hardware decoding is enabled with no OpenCL on non-HDR file' , async ( ) = > {
storageMock . readdir . mockResolvedValue ( [ 'renderD128' ] ) ;
storageMock . stat . mockResolvedValue ( { isFile : ( ) = > false , isCharacterDevice : ( ) = > false } as Stats ) ;
mediaMock . probe . mockResolvedValue ( probeStub . noAudioStreams ) ;
systemMock . get . mockResolvedValue ( {
ffmpeg : { accel : TranscodeHWAccel.RKMPP , accelDecode : true , crf : 30 , maxBitrate : '0' } ,
} ) ;
assetMock . getByIds . mockResolvedValue ( [ assetStub . video ] ) ;
await sut . handleVideoConversion ( { id : assetStub.video.id } ) ;
expect ( mediaMock . transcode ) . toHaveBeenCalledWith (
'/original/path.ext' ,
'upload/encoded-video/user-id/as/se/asset-id.mp4' ,
expect . objectContaining ( {
inputOptions : expect.arrayContaining ( [ '-hwaccel rkmpp' , '-hwaccel_output_format drm_prime' , '-afbc rga' ] ) ,
outputOptions : expect.arrayContaining ( [
expect . stringContaining ( 'scale_rkrga=-2:720:format=nv12:afbc=1:async_depth=4' ) ,
] ) ,
twoPass : false ,
} ) ,
) ;
} ) ;
it ( 'should use software decoding and tone-mapping if hardware decoding is disabled' , async ( ) = > {
storageMock . readdir . mockResolvedValue ( [ 'renderD128' ] ) ;
storageMock . stat . mockResolvedValue ( { isFile : ( ) = > true , isCharacterDevice : ( ) = > true } as Stats ) ;
@ -2252,7 +2274,7 @@ describe(MediaService.name, () => {
) ;
} ) ;
it ( 'should use software decoding and tone-mapping if opencl is not available', async ( ) = > {
it ( 'should use software tone-mapping if opencl is not available', async ( ) = > {
storageMock . readdir . mockResolvedValue ( [ 'renderD128' ] ) ;
storageMock . stat . mockResolvedValue ( { isFile : ( ) = > false , isCharacterDevice : ( ) = > false } as Stats ) ;
mediaMock . probe . mockResolvedValue ( probeStub . videoStreamHDR ) ;
@ -2265,7 +2287,7 @@ describe(MediaService.name, () => {
'/original/path.ext' ,
'upload/encoded-video/user-id/as/se/asset-id.mp4' ,
expect . objectContaining ( {
inputOptions : [ ] ,
inputOptions : expect.any ( Array ) ,
outputOptions : expect.arrayContaining ( [
expect . stringContaining (
'tonemapx=tonemap=hable:desat=0:p=bt709:t=bt709:m=bt709:r=pc:peak=100:format=yuv420p' ,