Skip to content

Commit

Permalink
for #742, fix publish recv thread bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 23, 2017
2 parents 4583a63 + 954bb18 commit 39aee2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions trunk/src/app/srs_app_rtmp_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* svr, st_netfd_t c, string cip)
realtime = SRS_PERF_MIN_LATENCY_ENABLED;
send_min_interval = 0;
tcp_nodelay = false;

client_type = SrsRtmpConnUnknown;

_srs_config->subscribe(this);
}

Expand Down Expand Up @@ -709,6 +710,7 @@ int SrsRtmpConn::stream_service_cycle()
source->source_id(), source->source_id());
source->set_cache(enabled_cache);

client_type = type;
switch (type) {
case SrsRtmpConnPlay: {
srs_verbose("start to play stream %s.", req->stream.c_str());
Expand Down Expand Up @@ -1037,7 +1039,9 @@ int SrsRtmpConn::publishing(SrsSource* source)
// use isolate thread to recv,
// @see: https://github.com/ossrs/srs/issues/237
SrsPublishRecvThread trd(rtmp, req,
st_netfd_fileno(stfd), 0, this, source, true, vhost_is_edge);
st_netfd_fileno(stfd), 0, this, source,
client_type == SrsRtmpConnFMLEPublish,
vhost_is_edge);

srs_info("start to publish stream %s success", req->stream.c_str());
ret = do_publishing(source, &trd);
Expand Down
3 changes: 3 additions & 0 deletions trunk/src/app/srs_app_rtmp_conn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_st.hpp>
#include <srs_app_conn.hpp>
#include <srs_app_reload.hpp>
#include <srs_rtmp_stack.hpp>

class SrsServer;
class SrsRtmpServer;
Expand Down Expand Up @@ -150,6 +151,8 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl
int publish_normal_timeout;
// whether enable the tcp_nodelay.
bool tcp_nodelay;
// The type of client, play or publish.
SrsRtmpConnType client_type;
public:
SrsRtmpConn(SrsServer* svr, st_netfd_t c, std::string cip);
virtual ~SrsRtmpConn();
Expand Down

0 comments on commit 39aee2b

Please sign in to comment.