Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-12-04 11:29:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0ea8cd9e844bf07efe43ee233c445c76e9b12b91
0ea8cd9e
1 parent
2cb8b7dd
for bug #248, use simple buffer for http.
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
84 行增加
和
81 行删除
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/rtmp/srs_protocol_buffer.cpp
trunk/src/rtmp/srs_protocol_buffer.hpp
trunk/src/app/srs_app_hls.cpp
查看文件 @
0ea8cd9
...
...
@@ -396,47 +396,6 @@ private:
}
};
SrsSimpleBuffer
::
SrsSimpleBuffer
()
{
}
SrsSimpleBuffer
::~
SrsSimpleBuffer
()
{
}
int
SrsSimpleBuffer
::
length
()
{
int
len
=
(
int
)
data
.
size
();
srs_assert
(
len
>=
0
);
return
len
;
}
char
*
SrsSimpleBuffer
::
bytes
()
{
return
(
length
()
==
0
)
?
NULL
:
&
data
.
at
(
0
);
}
void
SrsSimpleBuffer
::
erase
(
int
size
)
{
if
(
size
<=
0
)
{
return
;
}
if
(
size
>=
length
())
{
data
.
clear
();
return
;
}
data
.
erase
(
data
.
begin
(),
data
.
begin
()
+
size
);
}
void
SrsSimpleBuffer
::
append
(
const
char
*
bytes
,
int
size
)
{
srs_assert
(
size
>
0
);
data
.
insert
(
data
.
end
(),
bytes
,
bytes
+
size
);
}
SrsHlsAacJitter
::
SrsHlsAacJitter
()
{
base_pts
=
0
;
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
0ea8cd9
...
...
@@ -61,43 +61,7 @@ class SrsRequest;
class
SrsPithyPrint
;
class
SrsSource
;
class
SrsFileWriter
;
/**
* the simple buffer use vector to append bytes,
* it's for hls, and need to be refined in future.
*/
class
SrsSimpleBuffer
{
private
:
std
::
vector
<
char
>
data
;
public
:
SrsSimpleBuffer
();
virtual
~
SrsSimpleBuffer
();
public
:
/**
* get the length of buffer. empty if zero.
* @remark assert length() is not negative.
*/
virtual
int
length
();
/**
* get the buffer bytes.
* @return the bytes, NULL if empty.
*/
virtual
char
*
bytes
();
/**
* erase size of bytes from begin.
* @param size to erase size of bytes.
* clear if size greater than or equals to length()
* @remark ignore size is not positive.
*/
virtual
void
erase
(
int
size
);
/**
* append specified bytes to buffer.
* @param size the size of bytes
* @remark assert size is positive.
*/
virtual
void
append
(
const
char
*
bytes
,
int
size
);
};
class
SrsSimpleBuffer
;
/**
* jitter correct for audio,
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
0ea8cd9
...
...
@@ -537,7 +537,7 @@ SrsHttpHandler* SrsHttpHandler::create_http_stream()
SrsHttpMessage
::
SrsHttpMessage
()
{
_body
=
new
SrsBuffer
();
_body
=
new
Srs
Simple
Buffer
();
_state
=
SrsHttpParseStateInit
;
_uri
=
new
SrsHttpUri
();
_match
=
NULL
;
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
0ea8cd9
...
...
@@ -39,7 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_st.hpp>
class
SrsBuffer
;
class
Srs
Simple
Buffer
;
class
SrsRequest
;
class
SrsStSocket
;
class
SrsHttpUri
;
...
...
@@ -214,7 +214,7 @@ private:
* body object, in bytes.
* @remark, user can get body in string by get_body().
*/
SrsBuffer
*
_body
;
Srs
Simple
Buffer
*
_body
;
/**
* parser state
* @remark, user can use is_complete() to determine the state.
...
...
trunk/src/rtmp/srs_protocol_buffer.cpp
查看文件 @
0ea8cd9
...
...
@@ -27,6 +27,47 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_log.hpp>
#include <srs_kernel_utility.hpp>
SrsSimpleBuffer
::
SrsSimpleBuffer
()
{
}
SrsSimpleBuffer
::~
SrsSimpleBuffer
()
{
}
int
SrsSimpleBuffer
::
length
()
{
int
len
=
(
int
)
data
.
size
();
srs_assert
(
len
>=
0
);
return
len
;
}
char
*
SrsSimpleBuffer
::
bytes
()
{
return
(
length
()
==
0
)
?
NULL
:
&
data
.
at
(
0
);
}
void
SrsSimpleBuffer
::
erase
(
int
size
)
{
if
(
size
<=
0
)
{
return
;
}
if
(
size
>=
length
())
{
data
.
clear
();
return
;
}
data
.
erase
(
data
.
begin
(),
data
.
begin
()
+
size
);
}
void
SrsSimpleBuffer
::
append
(
const
char
*
bytes
,
int
size
)
{
srs_assert
(
size
>
0
);
data
.
insert
(
data
.
end
(),
bytes
,
bytes
+
size
);
}
IMergeReadHandler
::
IMergeReadHandler
()
{
}
...
...
trunk/src/rtmp/srs_protocol_buffer.hpp
查看文件 @
0ea8cd9
...
...
@@ -34,6 +34,43 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_io.hpp>
/**
* the simple buffer use vector to append bytes,
* it's for hls and http, and need to be refined in future.
*/
class
SrsSimpleBuffer
{
private
:
std
::
vector
<
char
>
data
;
public
:
SrsSimpleBuffer
();
virtual
~
SrsSimpleBuffer
();
public
:
/**
* get the length of buffer. empty if zero.
* @remark assert length() is not negative.
*/
virtual
int
length
();
/**
* get the buffer bytes.
* @return the bytes, NULL if empty.
*/
virtual
char
*
bytes
();
/**
* erase size of bytes from begin.
* @param size to erase size of bytes.
* clear if size greater than or equals to length()
* @remark ignore size is not positive.
*/
virtual
void
erase
(
int
size
);
/**
* append specified bytes to buffer.
* @param size the size of bytes
* @remark assert size is positive.
*/
virtual
void
append
(
const
char
*
bytes
,
int
size
);
};
// 4KB=4096
// 8KB=8192
// 16KB=16384
...
...
@@ -97,6 +134,7 @@ public:
* @return the bytes, NULL if empty.
*/
virtual
char
*
bytes
();
public
:
/**
* erase size of bytes from begin.
* @param size to erase size of bytes.
...
...
@@ -104,6 +142,7 @@ public:
* @remark ignore size is not positive.
*/
virtual
void
erase
(
int
size
);
private
:
/**
* append specified bytes to buffer.
* @param size the size of bytes
...
...
请
注册
或
登录
后发表评论