Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-bitrates.html

Issue 1682483002: MediaRecorder: remove ASSERTS in bitrate clamping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed =0 in MediaRecorderOptions, using has{,Video,Audio}BitsPerSecond() Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script> 2 <script src=../../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script> 3 <script src=../../resources/testharnessreport.js></script>
4 <script> 4 <script>
5 5
6 // This test verifies that MediaRecorder can be created or not with different 6 // This test verifies that MediaRecorder can be created or not with different
7 // bitrates for video, audio and for both [1]. It checks a few numerical bitrate 7 // bitrates for video, audio and for both [1]. It checks a few numerical bitrate
8 // allocations, asserting that individual bit rates are honored or clamped as 8 // allocations, asserting that individual bit rates are honored or clamped as
9 // expected, and how the overall bitsPerSecond is divided into video and audio 9 // expected, and how the overall bitsPerSecond is divided into video and audio
10 // bitrates. 10 // bitrates.
(...skipping 14 matching lines...) Expand all
25 const onError = test.unreached_func('Error creating MediaStream.'); 25 const onError = test.unreached_func('Error creating MediaStream.');
26 navigator.webkitGetUserMedia(constraints, gotStream, onError); 26 navigator.webkitGetUserMedia(constraints, gotStream, onError);
27 }, testName); 27 }, testName);
28 }; 28 };
29 29
30 const kTooSmallBps = 1000; 30 const kTooSmallBps = 1000;
31 const kTooLargeBps = 1000000000; 31 const kTooLargeBps = 1000000000;
32 32
33 const kOkVideoBps = 500000; 33 const kOkVideoBps = 500000;
34 const kMinVideoBps = 100000; 34 const kMinVideoBps = 100000;
35 // Note that unspecified audio bitrates are not clamped to a minimum.
35 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps }, 36 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps },
36 'Video bitrate OK', 37 'Video bitrate OK',
37 { video : kOkVideoBps, audio : 0 }); 38 { video : kOkVideoBps, audio : 0 });
38 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kTooSmallBps }, 39 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kTooSmallBps },
39 'Video bitrate clamped to minimum', 40 'Video bitrate clamped to minimum',
40 { video : kMinVideoBps, audio : 0 }); 41 { video : kMinVideoBps, audio : 0 });
42 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : 0 },
43 'Video bitrate explicitly set to 0 is clamped',
44 { video : kMinVideoBps, audio : 0 });
41 45
42 const kOkAudioBps = 10000; 46 const kOkAudioBps = 10000;
43 const kMinAudioBps = 6000; // https://www.opus-codec.org/ 47 const kMinAudioBps = 6000; // https://www.opus-codec.org/
44 const kMaxAudioBps = 128000; 48 const kMaxAudioBps = 128000;
49 // Note that unspecified video bitrates are not clamped to a minimum.
45 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps }, 50 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps },
46 'Audio bitrate OK', 51 'Audio bitrate OK',
47 { audio : kOkAudioBps, video : 0 }); 52 { audio : kOkAudioBps, video : 0 });
48 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kTooSmallBps }, 53 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kTooSmallBps },
49 'Audio bitrate clamped to minimum', 54 'Audio bitrate clamped to minimum',
50 { audio : kMinAudioBps, video : 0 }); 55 { audio : kMinAudioBps, video : 0 });
51 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kTooLargeBps }, 56 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kTooLargeBps },
52 'Audio bitrate clamped to maximum', 57 'Audio bitrate clamped to maximum',
53 { audio : kMaxAudioBps , video : 0}); 58 { audio : kMaxAudioBps , video : 0});
59 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : 0 },
60 'Audio bitrate explicitly 0 is clamped',
61 { audio : kMinAudioBps, video : 0 });
62
63 makeExpectedBitrateAsyncTest({},
64 'Unspecified bitrates are not clamped',
65 { video : 0, audio : 0 });
66
67
54 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, audioBitsPerSec ond : kOkAudioBps }, 68 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, audioBitsPerSec ond : kOkAudioBps },
55 'Video and audio bitrates OK', 69 'Video and audio bitrates OK',
56 { video : kOkVideoBps, audio : kOkAudioBps }); 70 { video : kOkVideoBps, audio : kOkAudioBps });
57 71
58 const kOkOverallBps = 120000; 72 const kOkOverallBps = 120000;
59 makeExpectedBitrateAsyncTest({ bitsPerSecond : kOkOverallBps }, 73 makeExpectedBitrateAsyncTest({ bitsPerSecond : kOkOverallBps },
60 'Overall bitrate OK (divided 90/10 video/audio)', 74 'Overall bitrate OK (divided 90/10 video/audio)',
61 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 }); 75 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 });
62 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, bitsPerSecond : kOkOverallBps }, 76 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, bitsPerSecond : kOkOverallBps },
63 'Overall bitrate OK, w/ explicit video bitrate igno red', 77 'Overall bitrate OK, w/ explicit video bitrate igno red',
64 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 }); 78 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 });
65 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps, bitsPerSecond : kOkOverallBps }, 79 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps, bitsPerSecond : kOkOverallBps },
66 'Overall bitrate OK, w/ explicit audio bitrate ign ored', 80 'Overall bitrate OK, w/ explicit audio bitrate ign ored',
67 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 }); 81 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 });
68 82
69 makeExpectedBitrateAsyncTest({ bitsPerSecond : 10E6 }, 83 makeExpectedBitrateAsyncTest({ bitsPerSecond : 10E6 },
70 'Overall bitrate leads to audio clamped to its maxi mum', 84 'Overall bitrate leads to audio clamped to its maxi mum',
71 { video : 10E6 - kMaxAudioBps, audio : kMaxAudioBps }); 85 { video : 10E6 - kMaxAudioBps, audio : kMaxAudioBps });
72 makeExpectedBitrateAsyncTest({ bitsPerSecond : (kMinVideoBps - 1E3) }, 86 makeExpectedBitrateAsyncTest({ bitsPerSecond : (kMinVideoBps - 1E3) },
73 'Overall bitrate leads to video clamped to its mini mum', 87 'Overall bitrate leads to video clamped to its mini mum',
74 { video : kMinVideoBps, audio : (kMinVideoBps - 1E3 ) * 0.1 }); 88 { video : kMinVideoBps, audio : (kMinVideoBps - 1E3 ) * 0.1 });
75 makeExpectedBitrateAsyncTest({ bitsPerSecond : kTooSmallBps }, 89 makeExpectedBitrateAsyncTest({ bitsPerSecond : kTooSmallBps },
76 'Overall bitrate leads to both audio and video clam ped to min', 90 'Overall bitrate leads to both audio and video clam ped to min',
77 { video : kMinVideoBps, audio : kMinAudioBps }); 91 { video : kMinVideoBps, audio : kMinAudioBps });
78 92
93 const kMaxUint32Value = 4294967296;
94 const kMaxInt32Value = (kMaxUint32Value / 2) - 1;
philipj_slow 2016/02/15 04:12:27 Just kMaxInt32Value=2147483647 or Math.pow(2,31)-1
mcasas 2016/02/17 00:20:28 Done.
95 makeExpectedBitrateAsyncTest({ bitsPerSecond : -1 },
96 'Overall bitrate too large is clamped',
97 { video : kMaxInt32Value - kMaxAudioBps, audio : kM axAudioBps});
79 98
80 </script> 99 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698