Skip to content

Commit

Permalink
refine code, move the ISrsBufferReader to srs_protocol_io
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Dec 3, 2014
1 parent ea0e837 commit adf95d2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
1 change: 1 addition & 0 deletions trunk/src/app/srs_app_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions trunk/src/rtmp/srs_protocol_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
17 changes: 3 additions & 14 deletions trunk/src/rtmp/srs_protocol_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions trunk/src/rtmp/srs_protocol_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
}
Expand Down
15 changes: 13 additions & 2 deletions trunk/src/rtmp/srs_protocol_io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
+---------------+ +--------------------+ +---------------+
Expand All @@ -62,6 +60,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.
*/
Expand Down
1 change: 1 addition & 0 deletions trunk/src/rtmp/srs_protocol_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit adf95d2

Please sign in to comment.