toxon
/
tox.rb
Archived
1
0
Fork 0

Fix error

This commit is contained in:
Braiden Vasco 2018-05-01 05:35:40 +00:00
parent 423187748b
commit 44a64d6134
No known key found for this signature in database
GPG Key ID: F1D3CA63437BDC6F
2 changed files with 9 additions and 9 deletions

View File

@ -37,15 +37,15 @@ module Tox
private
def y_plane_size_valid?
y_plane.bytesize == width * height * 2
y_plane.bytesize == width * height
end
def u_plane_size_valid?
u_plane.bytesize == (width / 2) * (height / 2) * 2
u_plane.bytesize == (width / 2) * (height / 2)
end
def v_plane_size_valid?
v_plane.bytesize == (width / 2) * (height / 2) * 2
v_plane.bytesize == (width / 2) * (height / 2)
end
end
end

View File

@ -144,14 +144,14 @@ RSpec.describe Tox::VideoFrame do
let(:width) { rand 640..1024 }
let(:height) { rand 480..768 }
let(:y_plane) { SecureRandom.random_bytes width * height * 2 }
let(:y_plane) { SecureRandom.random_bytes width * height }
let :u_plane do
SecureRandom.random_bytes((width / 2) * (height / 2) * 2)
SecureRandom.random_bytes((width / 2) * (height / 2))
end
let :v_plane do
SecureRandom.random_bytes((width / 2) * (height / 2) * 2)
SecureRandom.random_bytes((width / 2) * (height / 2))
end
specify do
@ -160,7 +160,7 @@ RSpec.describe Tox::VideoFrame do
context 'when Y plane size is invalid' do
let :y_plane do
SecureRandom.random_bytes width * height * 2 + [1, -1, 2, -2].sample
SecureRandom.random_bytes width * height + [1, -1, 2, -2].sample
end
specify do
@ -171,7 +171,7 @@ RSpec.describe Tox::VideoFrame do
context 'when U plane size is invalid' do
let :u_plane do
SecureRandom.random_bytes(
(width / 2) * (height / 2) * 2 + [1, -1, 2, -2].sample,
(width / 2) * (height / 2) + [1, -1, 2, -2].sample,
)
end
@ -183,7 +183,7 @@ RSpec.describe Tox::VideoFrame do
context 'when V plane size is invalid' do
let :v_plane do
SecureRandom.random_bytes(
(width / 2) * (height / 2) * 2 + [1, -1, 2, -2].sample,
(width / 2) * (height / 2) + [1, -1, 2, -2].sample,
)
end