winlin

merge from srs2

@@ -105,11 +105,12 @@ namespace internal @@ -105,11 +105,12 @@ namespace internal
105 return ret; 105 return ret;
106 } 106 }
107 107
  108 + disposed = false;
108 // we set to loop to true for thread to run. 109 // we set to loop to true for thread to run.
109 loop = true; 110 loop = true;
110 111
111 // wait for cid to ready, for parent thread to get the cid. 112 // wait for cid to ready, for parent thread to get the cid.
112 - while (_cid < 0 && loop) { 113 + while (_cid < 0) {
113 st_usleep(10 * 1000); 114 st_usleep(10 * 1000);
114 } 115 }
115 116
@@ -129,6 +130,8 @@ namespace internal @@ -129,6 +130,8 @@ namespace internal
129 130
130 dispose(); 131 dispose();
131 132
  133 + _cid = -1;
  134 + can_run = false;
132 tid = NULL; 135 tid = NULL;
133 } 136 }
134 137
@@ -105,7 +105,7 @@ bool SrsBuffer::empty() @@ -105,7 +105,7 @@ bool SrsBuffer::empty()
105 105
106 bool SrsBuffer::require(int required_size) 106 bool SrsBuffer::require(int required_size)
107 { 107 {
108 - srs_assert(required_size > 0); 108 + srs_assert(required_size >= 0);
109 109
110 return required_size <= nb_bytes - (p - bytes); 110 return required_size <= nb_bytes - (p - bytes);
111 } 111 }