Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC: fix rtc publisher pli cid #3318

Merged
merged 5 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 6.0 Changelog

* v6.0, 2023-01-19, Merge [#3318](https://github.com/ossrs/srs/pull/3318): RTC: fix rtc publisher pli cid. v6.0.19 (#3318)
* v6.0, 2023-01-18, Merge [#3382](https://github.com/ossrs/srs/pull/3382): Rewrite research/api-server code by Go, remove Python. v6.0.18 (#3382)
* v6.0, 2023-01-18, Merge [#3386](https://github.com/ossrs/srs/pull/3386): SRT: fix crash when srt_to_rtmp off. v6.0.17 (#3386)
* v5.0, 2023-01-17, Merge [#3385](https://github.com/ossrs/srs/pull/3385): API: Support server/pid/service label for exporter and api. v6.0.16 (#3385)
Expand All @@ -32,6 +33,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2023-01-19, Merge [#3318](https://github.com/ossrs/srs/pull/3318): RTC: fix rtc publisher pli cid. v5.0.138 (#3318)
* v5.0, 2023-01-18, Merge [#3382](https://github.com/ossrs/srs/pull/3382): Rewrite research/api-server code by Go, remove Python. v5.0.137 (#3382)
* v5.0, 2023-01-18, Merge [#3386](https://github.com/ossrs/srs/pull/3386): SRT: fix crash when srt_to_rtmp off. v5.0.136 (#3386)
* v5.0, 2023-01-17, Merge [#3385](https://github.com/ossrs/srs/pull/3385): API: Support server/pid/service label for exporter and api. v5.0.135 (#3385)
Expand Down
9 changes: 4 additions & 5 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ srs_error_t SrsRtcPlayStream::do_request_keyframe(uint32_t ssrc, SrsContextId ci
return err;
}

publisher->request_keyframe(ssrc);
publisher->request_keyframe(ssrc, cid);

return err;
}
Expand Down Expand Up @@ -1611,15 +1611,14 @@ srs_error_t SrsRtcPublishStream::on_rtcp_xr(SrsRtcpXr* rtcp)
return err;
}

void SrsRtcPublishStream::request_keyframe(uint32_t ssrc)
void SrsRtcPublishStream::request_keyframe(uint32_t ssrc, SrsContextId cid)
winlinvip marked this conversation as resolved.
Show resolved Hide resolved
{
SrsContextId sub_cid = _srs_context->get_id();
pli_worker_->request_keyframe(ssrc, sub_cid);
pli_worker_->request_keyframe(ssrc, cid);

uint32_t nn = 0;
if (pli_epp->can_print(ssrc, &nn)) {
// The player(subscriber) cid, which requires PLI.
srs_trace("RTC: Need PLI ssrc=%u, play=[%s], publish=[%s], count=%u/%u", ssrc, sub_cid.c_str(),
srs_trace("RTC: Need PLI ssrc=%u, play=[%s], publish=[%s], count=%u/%u", ssrc, cid.c_str(),
cid_.c_str(), nn, pli_epp->nn_count);
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_rtc_conn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class SrsRtcPublishStream : public ISrsRtspPacketDecodeHandler
srs_error_t on_rtcp_sr(SrsRtcpSR* rtcp);
srs_error_t on_rtcp_xr(SrsRtcpXr* rtcp);
public:
void request_keyframe(uint32_t ssrc);
void request_keyframe(uint32_t ssrc, SrsContextId cid);
virtual srs_error_t do_request_keyframe(uint32_t ssrc, SrsContextId cid);
public:
void simulate_nack_drop(int nn);
Expand Down
3 changes: 2 additions & 1 deletion trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,8 @@ srs_error_t SrsRtcSource::on_timer(srs_utime_t interval)

for (int i = 0; i < (int)stream_desc_->video_track_descs_.size(); i++) {
SrsRtcTrackDescription* desc = stream_desc_->video_track_descs_.at(i);
publish_stream_->request_keyframe(desc->ssrc_);
srs_trace("RTC: to rtmp bridge request key frame, ssrc=%u, publisher cid=%s", desc->ssrc_, publish_stream_->context_id().c_str());
winlinvip marked this conversation as resolved.
Show resolved Hide resolved
publish_stream_->request_keyframe(desc->ssrc_, publish_stream_->context_id());
}

return err;
Expand Down
4 changes: 3 additions & 1 deletion trunk/src/app/srs_app_rtc_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ class ISrsRtcPublishStream
virtual ~ISrsRtcPublishStream();
public:
// Request keyframe(PLI) from publisher, for fresh consumer.
virtual void request_keyframe(uint32_t ssrc) = 0;
virtual void request_keyframe(uint32_t ssrc, SrsContextId cid) = 0;
// Get context id.
virtual const SrsContextId& context_id() = 0;
};

class ISrsRtcSourceEventHandler
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 137
#define VERSION_REVISION 138

#endif
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 18
#define VERSION_REVISION 19

#endif