mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #913, Kernel MP4 FLV HTTP support complex error.
This commit is contained in:
parent
9802dc326e
commit
204ef041da
23 changed files with 1413 additions and 1660 deletions
|
@ -39,19 +39,14 @@ ISrsCodec::~ISrsCodec()
|
|||
|
||||
SrsBuffer::SrsBuffer()
|
||||
{
|
||||
set_value(NULL, 0);
|
||||
p = bytes = NULL;
|
||||
nb_bytes = 0;
|
||||
|
||||
// TODO: support both little and big endian.
|
||||
srs_assert(srs_is_little_endian());
|
||||
}
|
||||
|
||||
SrsBuffer::SrsBuffer(char* b, int nb_b)
|
||||
{
|
||||
set_value(b, nb_b);
|
||||
}
|
||||
|
||||
SrsBuffer::~SrsBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
void SrsBuffer::set_value(char* b, int nb_b)
|
||||
{
|
||||
p = bytes = b;
|
||||
nb_bytes = nb_b;
|
||||
|
@ -60,27 +55,8 @@ void SrsBuffer::set_value(char* b, int nb_b)
|
|||
srs_assert(srs_is_little_endian());
|
||||
}
|
||||
|
||||
int SrsBuffer::initialize(char* b, int nb)
|
||||
SrsBuffer::~SrsBuffer()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!b) {
|
||||
ret = ERROR_KERNEL_STREAM_INIT;
|
||||
srs_error("stream param bytes must not be NULL. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (nb <= 0) {
|
||||
ret = ERROR_KERNEL_STREAM_INIT;
|
||||
srs_error("stream param size must be positive. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nb_bytes = nb;
|
||||
p = bytes = b;
|
||||
srs_info("init stream ok, size=%d", size());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* SrsBuffer::data()
|
||||
|
@ -98,6 +74,11 @@ int SrsBuffer::pos()
|
|||
return (int)(p - bytes);
|
||||
}
|
||||
|
||||
int SrsBuffer::left()
|
||||
{
|
||||
return nb_bytes - (int)(p - bytes);
|
||||
}
|
||||
|
||||
bool SrsBuffer::empty()
|
||||
{
|
||||
return !bytes || (p >= bytes + nb_bytes);
|
||||
|
@ -281,11 +262,11 @@ SrsBitBuffer::~SrsBitBuffer()
|
|||
{
|
||||
}
|
||||
|
||||
int SrsBitBuffer::initialize(SrsBuffer* s) {
|
||||
srs_error_t SrsBitBuffer::initialize(SrsBuffer* s) {
|
||||
stream = s;
|
||||
cb = 0;
|
||||
cb_left = 0;
|
||||
return ERROR_SUCCESS;
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
bool SrsBitBuffer::empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue