正在显示
5 个修改的文件
包含
14 行增加
和
14 行删除
| @@ -252,30 +252,30 @@ void SrsBuffer::write_bytes(char* data, int size) | @@ -252,30 +252,30 @@ void SrsBuffer::write_bytes(char* data, int size) | ||
| 252 | p += size; | 252 | p += size; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | -SrsBitStream::SrsBitStream() | 255 | +SrsBitBuffer::SrsBitBuffer() |
| 256 | { | 256 | { |
| 257 | cb = 0; | 257 | cb = 0; |
| 258 | cb_left = 0; | 258 | cb_left = 0; |
| 259 | stream = NULL; | 259 | stream = NULL; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | -SrsBitStream::~SrsBitStream() | 262 | +SrsBitBuffer::~SrsBitBuffer() |
| 263 | { | 263 | { |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | -int SrsBitStream::initialize(SrsBuffer* s) { | 266 | +int SrsBitBuffer::initialize(SrsBuffer* s) { |
| 267 | stream = s; | 267 | stream = s; |
| 268 | return ERROR_SUCCESS; | 268 | return ERROR_SUCCESS; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | -bool SrsBitStream::empty() { | 271 | +bool SrsBitBuffer::empty() { |
| 272 | if (cb_left) { | 272 | if (cb_left) { |
| 273 | return false; | 273 | return false; |
| 274 | } | 274 | } |
| 275 | return stream->empty(); | 275 | return stream->empty(); |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | -int8_t SrsBitStream::read_bit() { | 278 | +int8_t SrsBitBuffer::read_bit() { |
| 279 | if (!cb_left) { | 279 | if (!cb_left) { |
| 280 | srs_assert(!stream->empty()); | 280 | srs_assert(!stream->empty()); |
| 281 | cb = stream->read_1bytes(); | 281 | cb = stream->read_1bytes(); |
| @@ -159,15 +159,15 @@ public: | @@ -159,15 +159,15 @@ public: | ||
| 159 | /** | 159 | /** |
| 160 | * the bit stream. | 160 | * the bit stream. |
| 161 | */ | 161 | */ |
| 162 | -class SrsBitStream | 162 | +class SrsBitBuffer |
| 163 | { | 163 | { |
| 164 | private: | 164 | private: |
| 165 | int8_t cb; | 165 | int8_t cb; |
| 166 | u_int8_t cb_left; | 166 | u_int8_t cb_left; |
| 167 | SrsBuffer* stream; | 167 | SrsBuffer* stream; |
| 168 | public: | 168 | public: |
| 169 | - SrsBitStream(); | ||
| 170 | - virtual ~SrsBitStream(); | 169 | + SrsBitBuffer(); |
| 170 | + virtual ~SrsBitBuffer(); | ||
| 171 | public: | 171 | public: |
| 172 | virtual int initialize(SrsBuffer* s); | 172 | virtual int initialize(SrsBuffer* s); |
| 173 | virtual bool empty(); | 173 | virtual bool empty(); |
| @@ -981,7 +981,7 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) | @@ -981,7 +981,7 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp) | ||
| 981 | return ret; | 981 | return ret; |
| 982 | } | 982 | } |
| 983 | 983 | ||
| 984 | - SrsBitStream bs; | 984 | + SrsBitBuffer bs; |
| 985 | if ((ret = bs.initialize(&stream)) != ERROR_SUCCESS) { | 985 | if ((ret = bs.initialize(&stream)) != ERROR_SUCCESS) { |
| 986 | return ret; | 986 | return ret; |
| 987 | } | 987 | } |
| @@ -48,7 +48,7 @@ using namespace std; | @@ -48,7 +48,7 @@ using namespace std; | ||
| 48 | // @see SRS_SYS_TIME_RESOLUTION_MS_TIMES | 48 | // @see SRS_SYS_TIME_RESOLUTION_MS_TIMES |
| 49 | #define SYS_TIME_RESOLUTION_US 300*1000 | 49 | #define SYS_TIME_RESOLUTION_US 300*1000 |
| 50 | 50 | ||
| 51 | -int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v) | 51 | +int srs_avc_nalu_read_uev(SrsBitBuffer* stream, int32_t& v) |
| 52 | { | 52 | { |
| 53 | int ret = ERROR_SUCCESS; | 53 | int ret = ERROR_SUCCESS; |
| 54 | 54 | ||
| @@ -82,7 +82,7 @@ int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v) | @@ -82,7 +82,7 @@ int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v) | ||
| 82 | return ret; | 82 | return ret; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | -int srs_avc_nalu_read_bit(SrsBitStream* stream, int8_t& v) | 85 | +int srs_avc_nalu_read_bit(SrsBitBuffer* stream, int8_t& v) |
| 86 | { | 86 | { |
| 87 | int ret = ERROR_SUCCESS; | 87 | int ret = ERROR_SUCCESS; |
| 88 | 88 |
| @@ -34,15 +34,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -34,15 +34,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 34 | #include <vector> | 34 | #include <vector> |
| 35 | 35 | ||
| 36 | class SrsBuffer; | 36 | class SrsBuffer; |
| 37 | -class SrsBitStream; | 37 | +class SrsBitBuffer; |
| 38 | 38 | ||
| 39 | // compare | 39 | // compare |
| 40 | #define srs_min(a, b) (((a) < (b))? (a) : (b)) | 40 | #define srs_min(a, b) (((a) < (b))? (a) : (b)) |
| 41 | #define srs_max(a, b) (((a) < (b))? (b) : (a)) | 41 | #define srs_max(a, b) (((a) < (b))? (b) : (a)) |
| 42 | 42 | ||
| 43 | // read nalu uev. | 43 | // read nalu uev. |
| 44 | -extern int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v); | ||
| 45 | -extern int srs_avc_nalu_read_bit(SrsBitStream* stream, int8_t& v); | 44 | +extern int srs_avc_nalu_read_uev(SrsBitBuffer* stream, int32_t& v); |
| 45 | +extern int srs_avc_nalu_read_bit(SrsBitBuffer* stream, int8_t& v); | ||
| 46 | 46 | ||
| 47 | // get current system time in ms, use cache to avoid performance problem | 47 | // get current system time in ms, use cache to avoid performance problem |
| 48 | extern int64_t srs_get_system_time_ms(); | 48 | extern int64_t srs_get_system_time_ms(); |
-
请 注册 或 登录 后发表评论