Research Article

Scalable Video Streaming for Single-Hop Wireless Networks Using a Contention-Based Access MAC Protocol

Algorithm 2

Compute pi's given all Ri's.
[p1,p2,,pN,success]=Compute_p(R1,R2,,RN,N)
ϵ=0.01
I=1
{I is the percentage of idle slots}
search_step=0.01
success=0
for i=1 to N do
Si=RiTXOP×(1i=1NRi)
end for
while I<1 do
for i=1 to N do
pi=SiI+Si
end for
{run Algorithm 1 to compute collision probability C}
C=Compute_C(p1,p2,,pN,N)
total=I+C(RTS+DIFS)+i=1NSi(RTS)
{check for boundary condition smaller ϵ results in higher accuracy}
if (abs(total1)<ϵ) then
success=1
return[p1,p2,,pN,success]
end if
I=Isearch_step
endwhile{fail to find p, success=0}
return[0,0,,0,success]