Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Sep 8, 2023
1 parent 7a62999 commit 4a96b00
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions video/profiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "low-bitrate", Width: 640, Height: 360, Bitrate: 500_000},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_001},
{Name: "low-bitrate", Width: 640, Height: 360, Bitrate: 500_000, Quality: defaultQuality},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_001, Quality: defaultQuality},
},
},
{
Expand All @@ -41,8 +41,8 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "low-bitrate", Width: 640, Height: 360, Bitrate: 250_000},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 500_000},
{Name: "low-bitrate", Width: 640, Height: 360, Bitrate: 250_000, Quality: defaultQuality},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 500_000, Quality: defaultQuality},
},
},
{
Expand All @@ -56,8 +56,8 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_000},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 4_000_001},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_000, Quality: defaultQuality},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 4_000_001, Quality: defaultQuality},
},
},
{
Expand All @@ -71,8 +71,8 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 266_666},
{Name: "720p0", Width: 1200, Height: 720, Bitrate: 1_000_001},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 320_000, Quality: defaultQuality},
{Name: "720p0", Width: 1200, Height: 720, Bitrate: 1_000_001, Quality: defaultQuality},
},
},
{
Expand All @@ -86,9 +86,9 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 555_555},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 2_222_222},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: 5_000_000},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 666_666, Quality: defaultQuality},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 2_666_666, Quality: defaultQuality},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: 5_000_000, Quality: defaultQuality},
},
},
{
Expand All @@ -102,8 +102,8 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "low-bitrate", Width: 400, Height: 240, Bitrate: 258549},
{Name: "240p0", Width: 400, Height: 240, Bitrate: 517099},
{Name: "low-bitrate", Width: 400, Height: 240, Bitrate: 258549, Quality: defaultQuality},
{Name: "240p0", Width: 400, Height: 240, Bitrate: 517099, Quality: defaultQuality},
},
},
{
Expand All @@ -117,9 +117,9 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_000},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 4_000_000},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: MaxVideoBitrate},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 1_000_000, Quality: defaultQuality},
{Name: "720p0", Width: 1280, Height: 720, Bitrate: 4_000_000, Quality: defaultQuality},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: MaxVideoBitrate, Quality: defaultQuality},
},
},
{
Expand All @@ -133,8 +133,23 @@ func TestGetDefaultPlaybackProfiles(t *testing.T) {
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 122_222},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: 1_100_000},
{Name: "360p0", Width: 640, Height: 360, Bitrate: 146_666, Quality: defaultQuality},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: 1_100_000, Quality: defaultQuality},
},
},
{
name: "low bitrate 1080p", // https://linear.app/livepeer/issue/VID-228/streameth-recording-uploaded-assets-returns-bad-quality
track: InputTrack{
Type: "video",
Bitrate: 1_100_000,
VideoTrack: VideoTrack{
Width: 1920,
Height: 1080,
},
},
want: []EncodedProfile{
{Name: "360p0", Width: 640, Height: 360, Bitrate: 146_666, Quality: defaultQuality},
{Name: "1080p0", Width: 1920, Height: 1080, Bitrate: 1_100_000, Quality: defaultQuality},
},
},
}
Expand Down

0 comments on commit 4a96b00

Please sign in to comment.