@@ -1566,6 +1566,17 @@ def test_fragmented_mp4(
15661566
15671567
15681568class TestStreamingEncoder :
1569+ cpu_and_oss_cuda = (
1570+ "cpu" ,
1571+ pytest .param (
1572+ "cuda" ,
1573+ marks = [
1574+ pytest .mark .needs_cuda ,
1575+ pytest .mark .skipif (in_fbcode (), reason = "NVENC not available in fbcode" ),
1576+ ],
1577+ ),
1578+ )
1579+
15691580 @staticmethod
15701581 def _create_encoder (method , tmp_path , format ):
15711582 if method == "to_file" :
@@ -1591,21 +1602,7 @@ def test_double_close(self, tmp_path, method):
15911602
15921603 @pytest .mark .parametrize ("format" , ["mp4" , "mov" , "mkv" ])
15931604 @pytest .mark .parametrize ("method" , ("to_file" , "to_file_like" ))
1594- @pytest .mark .parametrize (
1595- "device" ,
1596- (
1597- "cpu" ,
1598- pytest .param (
1599- "cuda" ,
1600- marks = [
1601- pytest .mark .needs_cuda ,
1602- pytest .mark .skipif (
1603- in_fbcode (), reason = "NVENC not available in fbcode"
1604- ),
1605- ],
1606- ),
1607- ),
1608- )
1605+ @pytest .mark .parametrize ("device" , cpu_and_oss_cuda )
16091606 def test_add_video_and_encode_frames (self , tmp_path , format , method , device ):
16101607 source_decoder = VideoDecoder (str (TEST_SRC_2_720P .path ))
16111608 source_frames = source_decoder .get_frames_in_range (start = 0 , stop = 10 ).data .to (
@@ -1659,21 +1656,7 @@ def test_create_invalid_format(self, tmp_path, method):
16591656
16601657 @pytest .mark .parametrize ("format" , ["mp4" , "mov" ])
16611658 @pytest .mark .parametrize ("method" , ("to_file" , "to_file_like" ))
1662- @pytest .mark .parametrize (
1663- "device" ,
1664- (
1665- "cpu" ,
1666- pytest .param (
1667- "cuda" ,
1668- marks = [
1669- pytest .mark .needs_cuda ,
1670- pytest .mark .skipif (
1671- in_fbcode (), reason = "NVENC not available in fbcode"
1672- ),
1673- ],
1674- ),
1675- ),
1676- )
1659+ @pytest .mark .parametrize ("device" , cpu_and_oss_cuda )
16771660 def test_fragmented_mp4 (self , format , tmp_path , method , device ):
16781661 source_decoder = VideoDecoder (str (TEST_SRC_2_720P .path ))
16791662 source_frames = source_decoder .get_frames_in_range (start = 0 , stop = 10 ).data .to (
@@ -1748,21 +1731,7 @@ def test_add_audio_twice_errors(self, tmp_path, method):
17481731 enc .add_audio (sample_rate = 16000 , num_channels = 1 )
17491732
17501733 @pytest .mark .parametrize ("method" , ("to_file" , "to_file_like" ))
1751- @pytest .mark .parametrize (
1752- "device" ,
1753- (
1754- "cpu" ,
1755- pytest .param (
1756- "cuda" ,
1757- marks = [
1758- pytest .mark .needs_cuda ,
1759- pytest .mark .skipif (
1760- in_fbcode (), reason = "NVENC not available in fbcode"
1761- ),
1762- ],
1763- ),
1764- ),
1765- )
1734+ @pytest .mark .parametrize ("device" , cpu_and_oss_cuda )
17661735 def test_write_frames_mismatched_dimensions_errors (self , tmp_path , method , device ):
17671736 enc , _ = self ._create_encoder (method , tmp_path , "mp4" )
17681737 video = enc .add_video (height = 256 , width = 256 , frame_rate = 30.0 , device = device )
0 commit comments