videoDecoder-codec-specific-orientation.https.any.js (1615B)
1 // META: global=window,dedicatedworker 2 // META: script=videoDecoder-codec-specific-setup.js 3 // META: variant=?av1 4 // META: variant=?vp8 5 // META: variant=?vp9 6 // META: variant=?h264_avc 7 // META: variant=?h264_annexb 8 // META: variant=?h265_hevc 9 // META: variant=?h265_annexb 10 11 promise_test(async t => { 12 await checkImplements(); 13 const config = { 14 ...CONFIG, 15 rotation: 90, 16 flip: true, 17 }; 18 19 const support = await VideoDecoder.isConfigSupported(config); 20 assert_true(support.supported, 'supported'); 21 assert_equals(support.config.rotation, config.rotation, 'rotation'); 22 assert_equals(support.config.flip, config.flip, 'flip'); 23 }, 'Test that isConfigSupported() with orientation'); 24 25 promise_test(async t => { 26 await checkImplements(); 27 const callbacks = {}; 28 const decoder = createVideoDecoder(t, callbacks); 29 let active_config = { 30 ...CONFIG, 31 rotation: 90, 32 flip: true, 33 }; 34 decoder.configure(active_config); 35 decoder.decode(CHUNKS[0]); 36 decoder.decode(CHUNKS[1]); 37 38 let outputs = 0; 39 callbacks.output = frame => { 40 outputs++; 41 assert_equals(frame.rotation, active_config.rotation, 'rotation'); 42 assert_equals(frame.flip, active_config.flip, 'flip'); 43 frame.close(); 44 }; 45 46 await decoder.flush(); 47 assert_equals(outputs, 2, 'outputs'); 48 49 // Reconfigure with a different orientation. 50 active_config = { 51 ...CONFIG, 52 rotation: 180, 53 flip: false, 54 }; 55 decoder.configure(active_config); 56 decoder.decode(CHUNKS[0]); 57 decoder.decode(CHUNKS[1]); 58 await decoder.flush(); 59 assert_equals(outputs, 4, 'outputs'); 60 }, 'Decode frames with orientation metadata');