-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
502 additions
and
328 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "HttpFlvConnection.h" | ||
|
||
using namespace xop; | ||
|
||
HttpFlvConnection::HttpFlvConnection(TaskScheduler* taskScheduler, SOCKET sockfd) | ||
: TcpConnection(taskScheduler, sockfd) | ||
{ | ||
|
||
} | ||
|
||
HttpFlvConnection::~HttpFlvConnection() | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef XOP_HTTP_FLV_CONNECTION_H | ||
#define XOP_HTTP_FLV_CONNECTION_H | ||
|
||
#include "net/EventLoop.h" | ||
#include "net/TcpConnection.h" | ||
|
||
namespace xop | ||
{ | ||
|
||
class HttpFlvConnection : public TcpConnection | ||
{ | ||
public: | ||
HttpFlvConnection(TaskScheduler* taskScheduler, SOCKET sockfd); | ||
~HttpFlvConnection(); | ||
}; | ||
|
||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "HttpFlvServer.h" | ||
#include "RtmpServer.h" | ||
#include "net/SocketUtil.h" | ||
#include "net/Logger.h" | ||
|
||
using namespace xop; | ||
|
||
HttpFlvServer::HttpFlvServer(xop::EventLoop *loop, std::string ip, uint16_t port) | ||
: TcpServer(loop, ip, port) | ||
{ | ||
if (this->start() != 0) | ||
{ | ||
LOG_INFO("HTTP-FLV Server listening on %u failed.", port); | ||
} | ||
else | ||
{ | ||
LOG_INFO("HTTP-FLV Server listen on %u.\n", port); | ||
} | ||
} | ||
|
||
HttpFlvServer::~HttpFlvServer() | ||
{ | ||
|
||
} | ||
|
||
void HttpFlvServer::attach(RtmpServer *rtmpServer) | ||
{ | ||
std::lock_guard<std::mutex> locker(m_mutex); | ||
m_rtmpServer = rtmpServer; | ||
} | ||
|
||
TcpConnection::Ptr HttpFlvServer::newConnection(SOCKET sockfd) | ||
{ | ||
return std::make_shared<HttpFlvConnection>(_eventLoop->getTaskScheduler().get(), sockfd); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef XOP_HTTP_FLV_SERVER_H | ||
#define XOP_HTTP_FLV_SERVER_H | ||
|
||
#include "net/TcpServer.h" | ||
#include "HttpFlvConnection.h" | ||
#include <mutex> | ||
|
||
namespace xop | ||
{ | ||
class RtmpServer; | ||
|
||
class HttpFlvServer : public TcpServer | ||
{ | ||
public: | ||
HttpFlvServer(xop::EventLoop *loop, std::string ip, uint16_t port = 8080); | ||
~HttpFlvServer(); | ||
|
||
void attach(RtmpServer *rtmpServer); | ||
|
||
private: | ||
TcpConnection::Ptr newConnection(SOCKET sockfd); | ||
|
||
std::mutex m_mutex; | ||
RtmpServer *m_rtmpServer = nullptr; | ||
xop::EventLoop *m_eventLoop = nullptr; | ||
}; | ||
|
||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.