1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

merge srs2.

This commit is contained in:
winlin 2016-09-12 18:21:44 +08:00
commit 504352d17a
2 changed files with 8 additions and 6 deletions

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 215
#define VERSION_REVISION 216
// generated by configure, only macros.
#include <srs_auto_headers.hpp>

View file

@ -146,11 +146,13 @@ int SrsFastStream::grow(ISrsBufferReader* reader, int required_size)
// the free space of buffer,
// buffer = consumed_bytes + exists_bytes + free_space.
int nb_free_space = (int)(buffer + nb_buffer - end);
// the bytes already in buffer
int nb_exists_bytes = (int)(end - p);
srs_assert(nb_exists_bytes >= 0);
// resize the space when no left space.
if (nb_free_space < required_size) {
// the bytes already in buffer
int nb_exists_bytes = (int)(end - p);
srs_assert(nb_exists_bytes >= 0);
if (nb_free_space < required_size - nb_exists_bytes) {
srs_verbose("move fast buffer %d bytes", nb_exists_bytes);
// reset or move to get more space.
@ -168,7 +170,7 @@ int SrsFastStream::grow(ISrsBufferReader* reader, int required_size)
// check whether enough free space in buffer.
nb_free_space = (int)(buffer + nb_buffer - end);
if (nb_free_space < required_size) {
if (nb_free_space < required_size - nb_exists_bytes) {
ret = ERROR_READER_BUFFER_OVERFLOW;
srs_error("buffer overflow, required=%d, max=%d, left=%d, ret=%d",
required_size, nb_buffer, nb_free_space, ret);