winlin

refine code, move the ISrsBufferReader to srs_protocol_io

... ... @@ -36,6 +36,7 @@ using namespace std;
#include <srs_app_http_conn.hpp>
#include <srs_app_json.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_protocol_buffer.hpp>
#define SRS_DEFAULT_HTTP_PORT 80
... ...
... ... @@ -34,14 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/241
#define SOCKET_READ_SIZE 4096
ISrsBufferReader::ISrsBufferReader()
{
}
ISrsBufferReader::~ISrsBufferReader()
{
}
SrsBuffer::SrsBuffer()
{
buffer = new char[SOCKET_READ_SIZE];
... ...
... ... @@ -21,8 +21,8 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_KERNEL_BUFFER_HPP
#define SRS_KERNEL_BUFFER_HPP
#ifndef SRS_PROTOCOL_BUFFER_HPP
#define SRS_PROTOCOL_BUFFER_HPP
/*
#include <srs_protocol_buffer.hpp>
... ... @@ -32,18 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <vector>
/**
* the reader for the buffer to read from whatever channel.
*/
class ISrsBufferReader
{
public:
ISrsBufferReader();
virtual ~ISrsBufferReader();
// for protocol/amf0/msg-codec
public:
virtual int read(void* buf, size_t size, ssize_t* nread) = 0;
};
#include <srs_protocol_io.hpp>
/**
* the buffer provices bytes cache for protocol. generally,
... ...
... ... @@ -23,6 +23,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_io.hpp>
ISrsBufferReader::ISrsBufferReader()
{
}
ISrsBufferReader::~ISrsBufferReader()
{
}
ISrsBufferWriter::ISrsBufferWriter()
{
}
... ...
... ... @@ -35,8 +35,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sys/uio.h>
#endif
#include <srs_protocol_buffer.hpp>
/**
* the system io reader/writer architecture:
+---------------+ +--------------------+ +---------------+
... ... @@ -63,6 +61,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* the reader for the buffer to read from whatever channel.
*/
class ISrsBufferReader
{
public:
ISrsBufferReader();
virtual ~ISrsBufferReader();
// for protocol/amf0/msg-codec
public:
virtual int read(void* buf, size_t size, ssize_t* nread) = 0;
};
/**
* the writer for the buffer to write to whatever channel.
*/
class ISrsBufferWriter
... ...
... ... @@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_stream.hpp>
#include <srs_core_autofree.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_protocol_buffer.hpp>
#include <stdlib.h>
using namespace std;
... ...