Example #1
0
  public void B(boolean flag) {
    boolean flag1 = !H.A(this);
    synchronized (P) {
      for (Iterator iterator = P.iterator(); iterator.hasNext(); ) {
        I i = (I) iterator.next();
        if (i.A()) {
          F++;
          A.C();
        }
        int j = 0;
        Packet b = i.D();
        int k = b.I();
        do {
          com.jcumulus.server.rtmfp.stream.B b1 = H.B();
          if (b1.D() < 12) {
            H.A(false);
            flag1 = true;
          }
          boolean flag2 = flag1;
          int l = k;
          int i1 = l + 4;
          N++;
          if (flag2) i1 += D(N);
          byte byte0 = 0;
          if (j > 0) byte0 |= com.jcumulus.server.rtmfp.publisher.E.M.intValue();
          if (i1 > b1.D()) {
            byte0 |= com.jcumulus.server.rtmfp.publisher.E.C.intValue();
            l = b1.D() - (i1 - l);
            i1 = b1.D();
            flag1 = true;
          } else {
            flag1 = false;
          }
          i1 -= 3;
          A(H.A(((byte) (flag2 ? 16 : 17)), (short) i1, this), N, byte0, flag2, b, l);
          i.B().put(Integer.valueOf(j), Integer.valueOf(N));
          k -= l;
          j += l;
        } while (k > 0);
        synchronized (O) {
          O.add(i);
        }
      }

      P.clear();
    }
    if (flag) H.A(true);
  }
Example #2
0
 public void A(AudioPacket a) {
   int i = a.J();
   if (i == 0) {
     G.error("Negative acknowledgment");
     D("Negative acknowledgment");
     return;
   }
   int j = L;
   int k = a.J();
   int l = L + 1;
   if (k > N) {
     G.error(
         (new StringBuilder())
             .append("Acknowledgment received ")
             .append(k)
             .append(" superior than the current sending stage ")
             .append(N)
             .append(" on flowWriter ")
             .append(J)
             .toString());
     L = N;
   } else if (k <= L) {
     if (a.I() == 0)
       G.debug(
           (new StringBuilder())
               .append("Acknowledgment ")
               .append(k)
               .append(" obsolete on flowWriter ")
               .append(J)
               .toString());
   } else {
     L = k;
   }
   int i1 = L;
   int j1 = a.H();
   while (a.I() > 0) i1 += a.J() + a.J() + 2;
   if (j1 != a.H()) a.E(j1);
   int k1 = 0;
   int l1 = 0;
   boolean flag = false;
   boolean flag1 = true;
   boolean flag2 = false;
   synchronized (O) {
     ListIterator listiterator = O.listIterator();
     do {
       if (flag2 || !listiterator.hasNext()) break;
       I i2 = (I) listiterator.next();
       if (i2.B().size() == 0) {
         G.error(
             (new StringBuilder())
                 .append("Message ")
                 .append(l + 1)
                 .append(" is bad formatted on flowWriter ")
                 .append(J)
                 .toString());
       } else {
         Integer ainteger[] = (Integer[]) i2.B().keySet().toArray(new Integer[0]);
         Integer integer = ainteger[0];
         int j2 = 0;
         do {
           if (j2 >= ainteger.length) break;
           if (L >= l) {
             i2.B().remove(ainteger[0]);
             ainteger = (Integer[]) i2.B().keySet().toArray(new Integer[0]);
             j2 = 0;
             if (j2 < ainteger.length) integer = ainteger[j2];
             D++;
             l++;
             continue;
           }
           do {
             if (flag2 || k1 != 0) break;
             if (k1 == 0)
               if (a.I() > 0) {
                 k1 = a.J() + 1;
                 l1 = k + 1;
                 k = l1 + k1 + a.J();
               } else {
                 flag2 = true;
                 break;
               }
             if (l1 > N) {
               G.error(
                   (new StringBuilder())
                       .append("Lost information received ")
                       .append(l1)
                       .append(" have not been yet sent on flowWriter ")
                       .append(J)
                       .toString());
               flag2 = true;
               break;
             }
             if (l1 > L) break;
             k1--;
             l1++;
           } while (true);
           if (flag2) break;
           if (l1 != l) {
             if (flag) {
               l++;
               if (j2 < ainteger.length - 1) {
                 j2++;
                 integer = ainteger[j2];
               }
               flag1 = true;
             } else {
               L = l;
             }
           } else if (!i2.A()) {
             if (flag) {
               j2++;
               integer = ainteger[j2];
               l++;
               flag1 = true;
             } else {
               G.debug(
                   (new StringBuilder())
                       .append("FlowWriter ")
                       .append(J)
                       .append(" : message ")
                       .append(l)
                       .append(" lost")
                       .toString());
               D--;
               M++;
               L = l;
             }
             k1--;
             l1++;
           } else {
             flag = true;
             if (((Integer) i2.B().get(integer)).intValue() >= i1 || k == l1 + 2) {
               l++;
               flag1 = true;
               k1--;
               l1++;
               if (j2 < ainteger.length - 1) {
                 j2++;
                 integer = ainteger[j2];
               }
             } else {
               G.debug(
                   (new StringBuilder())
                       .append("FlowWriter ")
                       .append(J)
                       .append(" : stage ")
                       .append(l)
                       .append(" repeated")
                       .toString());
               int k2 = integer.intValue();
               Packet b1 = i2.A(k2);
               int i3 = b1.I();
               i2.B().put(integer, Integer.valueOf(N));
               int j3 = i3;
               byte byte0 = 0;
               if (k2 > 0) byte0 |= com.jcumulus.server.rtmfp.publisher.E.M.intValue();
               if (j2 < ainteger.length - 1) {
                 j2++;
                 integer = ainteger[j2];
                 byte0 |= com.jcumulus.server.rtmfp.publisher.E.C.intValue();
                 j3 = integer.intValue() - k2;
               }
               com.jcumulus.server.rtmfp.stream.B b2 = H.B();
               int k3 = j3 + 4;
               if (!flag1 && k3 > b2.D()) {
                 H.A(false);
                 flag1 = true;
               }
               if (flag1) k3 += D(l);
               if (k3 > b2.D()) H.A(false);
               k3 -= 3;
               A(H.A(((byte) (flag1 ? 16 : 17)), k3, null), l, byte0, flag1, b1, j3);
               i3 -= j3;
               flag1 = false;
               k1--;
               l1++;
               l++;
             }
           }
         } while (true);
         if (i2.B().size() == 0) {
           if (i2.A()) F--;
           if (D > 0) {
             Packet b = i2.D();
             int l2 = b.I();
             A(D, M, b, l2);
             D = M = 0;
           }
           listiterator.remove();
         }
       }
     } while (true);
   }
   if (k1 > 0 && a.I() > 0)
     G.error(
         (new StringBuilder())
             .append("Some lost information received have not been yet sent on flowWriter ")
             .append(J)
             .toString());
   if (F == 0) A.B();
   else if (L > j || flag) A.A();
 }