mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Protobuf: Extract protobuf encoder.
This commit is contained in:
parent
a54d371549
commit
8bc7342c3c
6 changed files with 611 additions and 221 deletions
|
@ -339,6 +339,10 @@ void SrsBuffer::write_le8bytes(int64_t value)
|
|||
|
||||
void SrsBuffer::write_string(string value)
|
||||
{
|
||||
if (value.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
srs_assert(require((int)value.length()));
|
||||
|
||||
memcpy(p, value.data(), value.length());
|
||||
|
@ -347,6 +351,10 @@ void SrsBuffer::write_string(string value)
|
|||
|
||||
void SrsBuffer::write_bytes(char* data, int size)
|
||||
{
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
srs_assert(require(size));
|
||||
|
||||
memcpy(p, data, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue