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

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: philipj@ comments 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
54 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, audioBitsPerSec ond : kOkAudioBps }, 67 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, audioBitsPerSec ond : kOkAudioBps },
55 'Video and audio bitrates OK', 68 'Video and audio bitrates OK',
56 { video : kOkVideoBps, audio : kOkAudioBps }); 69 { video : kOkVideoBps, audio : kOkAudioBps });
57 70
58 const kOkOverallBps = 120000; 71 const kOkOverallBps = 120000;
59 makeExpectedBitrateAsyncTest({ bitsPerSecond : kOkOverallBps }, 72 makeExpectedBitrateAsyncTest({ bitsPerSecond : kOkOverallBps },
60 'Overall bitrate OK (divided 90/10 video/audio)', 73 'Overall bitrate OK (divided 90/10 video/audio)',
61 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 }); 74 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 });
62 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, bitsPerSecond : kOkOverallBps }, 75 makeExpectedBitrateAsyncTest({ videoBitsPerSecond : kOkVideoBps, bitsPerSecond : kOkOverallBps },
63 'Overall bitrate OK, w/ explicit video bitrate igno red', 76 'Overall bitrate OK, w/ explicit video bitrate igno red',
64 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 }); 77 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 });
65 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps, bitsPerSecond : kOkOverallBps }, 78 makeExpectedBitrateAsyncTest({ audioBitsPerSecond : kOkAudioBps, bitsPerSecond : kOkOverallBps },
66 'Overall bitrate OK, w/ explicit audio bitrate ign ored', 79 'Overall bitrate OK, w/ explicit audio bitrate igno red',
67 { video : kOkOverallBps * 0.9, audio : kOkOverallB ps * 0.1 }); 80 { video : kOkOverallBps * 0.9, audio : kOkOverallBp s * 0.1 });
68 81
69 makeExpectedBitrateAsyncTest({ bitsPerSecond : 10E6 }, 82 makeExpectedBitrateAsyncTest({ bitsPerSecond : 10E6 },
70 'Overall bitrate leads to audio clamped to its maxi mum', 83 'Overall bitrate leads to audio clamped to its maxi mum',
71 { video : 10E6 - kMaxAudioBps, audio : kMaxAudioBps }); 84 { video : 10E6 - kMaxAudioBps, audio : kMaxAudioBps });
72 makeExpectedBitrateAsyncTest({ bitsPerSecond : (kMinVideoBps - 1E3) }, 85 makeExpectedBitrateAsyncTest({ bitsPerSecond : (kMinVideoBps - 1E3) },
73 'Overall bitrate leads to video clamped to its mini mum', 86 'Overall bitrate leads to video clamped to its mini mum',
74 { video : kMinVideoBps, audio : (kMinVideoBps - 1E3 ) * 0.1 }); 87 { video : kMinVideoBps, audio : (kMinVideoBps - 1E3 ) * 0.1 });
75 makeExpectedBitrateAsyncTest({ bitsPerSecond : kTooSmallBps }, 88 makeExpectedBitrateAsyncTest({ bitsPerSecond : kTooSmallBps },
76 'Overall bitrate leads to both audio and video clam ped to min', 89 'Overall bitrate leads to both audio and video clam ped to min',
77 { video : kMinVideoBps, audio : kMinAudioBps }); 90 { video : kMinVideoBps, audio : kMinAudioBps });
78 91
92 makeExpectedBitrateAsyncTest({ videoBitsPerSecond: kOkVideoBps, bitsPerSecond: 0 },
93 'Overall bitrate 0 overrides specified video bitrat e',
94 { video: kMinVideoBps, audio: kMinAudioBps });
95 makeExpectedBitrateAsyncTest({ audioBitsPerSecond: kOkAudioBps, bitsPerSecond: 0 },
96 'Overall bitrate 0 overrides specified audio bitrat e',
97 { video: kMinVideoBps, audio: kMinAudioBps });
98
99 const kMaxInt32Value = Math.pow(2, 31) - 1;
100 makeExpectedBitrateAsyncTest({ bitsPerSecond : -1 },
101 'Overall bitrate too large is clamped',
102 { video : kMaxInt32Value - kMaxAudioBps, audio : kM axAudioBps});
79 103
80 </script> 104 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698