Checking iBufferLeft > iBufferUsed does not make sense, since this would stop writing into the buffer alredy after the buffer is half full, when there is less space left than has been used. The right check is iBufferLeft > 0.
Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 2 files). Show all
Unified · Split
| @@ -132,7 +132,7 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 131 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | iBufferLeft -= iBufferUsed; |
| 135 | − if (iBufferLeft > iBufferUsed) { | |
| 135 | + if (iBufferLeft > 0) { | |
| 136 | 136 | #if defined(_GNUC__) |
| 137 | 137 | iBufferUsed += strftime (&strStreamFileName[iBufferUsed], iBufferLeft, "%y%m%d%H%M%S", tTimeNow); |
| 138 | 138 | #else |
| @@ -150,7 +150,7 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 11 unmodified lines | ||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | iBufferLeftSize -= iBufferUsedSize; |
| 153 | − if (iBufferLeftSize > iBufferUsedSize) { | |
| 153 | + if (iBufferLeftSize > 0) { | |
| 154 | 154 | #if defined(_GNUC__) |
| 155 | 155 | iBufferUsedSize += strftime (&strLenFileName[iBufferUsedSize], iBufferLeftSize, "%y%m%d%H%M%S", tTimeNow); |
| 156 | 156 | #else |
| @@ -167,7 +167,7 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 10 unmodified lines | ||
| 167 | 167 | iBufferLeftSize -= iBufferUsedSize; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | − if (iBufferLeft > iBufferUsed) { | |
| 170 | + if (iBufferLeft > 0) { | |
| 171 | 171 | #ifdef _WIN32 |
| 172 | 172 | #if defined(_MSC_VER) |
| 173 | 173 | #if _MSC_VER>=1500 |
| @@ -182,7 +182,7 @@ CWelsH264SVCEncoder::CWelsH264SVCEncoder() · 8 unmodified lines | ||
| 182 | 182 | iBufferLeft -= iBufferUsed; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | − if (iBufferLeftSize > iBufferUsedSize) { | |
| 185 | + if (iBufferLeftSize > 0) { | |
| 186 | 186 | #ifdef _WIN32 |
| 187 | 187 | #if defined(_MSC_VER) |
| 188 | 188 | #if _MSC_VER>=1500 |