for bug #241, simplify the buffer, donot reset when chunk size change.
正在显示
3 个修改的文件
包含
1 行增加
和
34 行删除
@@ -200,25 +200,6 @@ void SrsFastBuffer::set_merge_read(bool v, int max_buffer, IMergeReadHandler* ha | @@ -200,25 +200,6 @@ void SrsFastBuffer::set_merge_read(bool v, int max_buffer, IMergeReadHandler* ha | ||
200 | } | 200 | } |
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | -void SrsFastBuffer::on_chunk_size(int32_t chunk_size) | ||
204 | -{ | ||
205 | - if (nb_buffer >= chunk_size) { | ||
206 | - return; | ||
207 | - } | ||
208 | - | ||
209 | - // limit the max buffer. | ||
210 | - int buffer_size = srs_min(chunk_size, SRS_MR_SOCKET_BUFFER); | ||
211 | - | ||
212 | - if (buffer_size != nb_buffer) { | ||
213 | - reset_buffer(buffer_size); | ||
214 | - } | ||
215 | -} | ||
216 | - | ||
217 | -int SrsFastBuffer::buffer_size() | ||
218 | -{ | ||
219 | - return nb_buffer; | ||
220 | -} | ||
221 | - | ||
222 | void SrsFastBuffer::reset_buffer(int size) | 203 | void SrsFastBuffer::reset_buffer(int size) |
223 | { | 204 | { |
224 | // remember the cap. | 205 | // remember the cap. |
@@ -163,17 +163,6 @@ public: | @@ -163,17 +163,6 @@ public: | ||
163 | */ | 163 | */ |
164 | virtual void set_merge_read(bool v, int max_buffer, IMergeReadHandler* handler); | 164 | virtual void set_merge_read(bool v, int max_buffer, IMergeReadHandler* handler); |
165 | #endif | 165 | #endif |
166 | -public: | ||
167 | - /** | ||
168 | - * when chunk size changed, the buffer should change the buffer also. | ||
169 | - * to keep the socket buffer size always greater than chunk size. | ||
170 | - * @see https://github.com/winlinvip/simple-rtmp-server/issues/241 | ||
171 | - */ | ||
172 | - virtual void on_chunk_size(int32_t chunk_size); | ||
173 | - /** | ||
174 | - * get the size of socket buffer to read. | ||
175 | - */ | ||
176 | - virtual int buffer_size(); | ||
177 | private: | 166 | private: |
178 | virtual void reset_buffer(int size); | 167 | virtual void reset_buffer(int size); |
179 | }; | 168 | }; |
@@ -1708,11 +1708,8 @@ int SrsProtocol::on_recv_message(SrsMessage* msg) | @@ -1708,11 +1708,8 @@ int SrsProtocol::on_recv_message(SrsMessage* msg) | ||
1708 | SRS_CONSTS_RTMP_MAX_CHUNK_SIZE); | 1708 | SRS_CONSTS_RTMP_MAX_CHUNK_SIZE); |
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | - int sock_buffer = in_buffer->buffer_size(); | ||
1712 | in_chunk_size = pkt->chunk_size; | 1711 | in_chunk_size = pkt->chunk_size; |
1713 | - in_buffer->on_chunk_size(pkt->chunk_size); | ||
1714 | - srs_trace("input chunk size to %d, sock buf %d=>%d", | ||
1715 | - pkt->chunk_size, sock_buffer, in_buffer->buffer_size()); | 1712 | + srs_trace("input chunk size to %d", pkt->chunk_size); |
1716 | 1713 | ||
1717 | break; | 1714 | break; |
1718 | } | 1715 | } |
-
请 注册 或 登录 后发表评论