Skip to content

Commit

Permalink
Forward: Bind the context id of source or stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 9, 2023
1 parent 5f9139e commit 47a5e27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion trunk/src/app/srs_app_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ srs_error_t SrsForwarder::initialize(SrsRequest* r, string ep)

// the ep(endpoint) to forward to
ep_forward = ep;

// Remember the source context id.
source_cid_ = _srs_context->get_id();

return err;
}
Expand Down Expand Up @@ -164,7 +167,10 @@ srs_error_t SrsForwarder::on_video(SrsSharedPtrMessage* shared_video)
srs_error_t SrsForwarder::cycle()
{
srs_error_t err = srs_success;


srs_trace("Forwarder: Start forward %s of source=[%s] to %s",
req->get_stream_url().c_str(), source_cid_.c_str(), ep_forward.c_str());

while (true) {
// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
Expand Down
3 changes: 3 additions & 0 deletions trunk/src/app/srs_app_forward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class SrsForwarder : public ISrsCoroutineHandler
// The ep to forward, server[:port].
std::string ep_forward;
SrsRequest* req;
private:
// The source or stream context id to bind to.
SrsContextId source_cid_;
private:
SrsCoroutine* trd;
private:
Expand Down

0 comments on commit 47a5e27

Please sign in to comment.