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: Support statistic for HTTP-API, HTTP-Callback and Security #2483

Merged
merged 8 commits into from
Jul 24, 2021

Conversation

duiniuluantanqin
Copy link
Member

No description provided.

@olivercloseoff6969
Copy link

Kk

@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2021

Codecov Report

Merging #2483 (32f39f7) into develop (33610c6) will increase coverage by 0.05%.
The diff coverage is 20.51%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2483      +/-   ##
===========================================
+ Coverage    42.66%   42.71%   +0.05%     
===========================================
  Files          102      102              
  Lines        36039    36052      +13     
===========================================
+ Hits         15376    15400      +24     
+ Misses       20663    20652      -11     

| Impacted Files | Coverage Δ | |'

Translated to English while maintaining the markdown structure:

'| Impacted Files | Coverage Δ | |
|---|---|---|
| trunk/src/app/srs_app_rtc_api.cpp | 0.00% <0.00%> (ø) | |'

Translated to English while maintaining the markdown structure:

| trunk/src/app/srs_app_rtc_api.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_source.cpp | 7.92% <0.00%> (-0.03%) | ⬇️ |
| trunk/src/app/srs_app_security.cpp | 90.00% <ø> (ø) | |
| trunk/src/protocol/srs_rtmp_stack.hpp | 100.00% <ø> (ø) | |

Translated to English while maintaining the markdown structure:

| trunk/src/app/srs_app_security.cpp | 90.00% <ø> (ø) | |
| trunk/src/protocol/srs_rtmp_stack.hpp | 100.00% <ø> (ø) | |
| trunk/src/app/srs_app_rtc_conn.cpp | 9.78% <33.33%> (+0.16%) | ⬆️ |
| trunk/src/protocol/srs_rtmp_stack.cpp | 89.47% <100.00%> (+<0.01%) | ⬆️ |
| trunk/src/app/srs_app_conn.cpp | 46.27% <0.00%> (+0.51%) | ⬆️ |
| trunk/src/protocol/srs_service_utility.cpp | 72.97% <0.00%> (+0.54%) | ⬆️ |
| trunk/src/app/srs_app_statistic.cpp | 4.67% <0.00%> (+4.67%) | ⬆️ |


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data'

Translated to English while maintaining the markdown structure:

'> Δ = absolute <relative> (impact), ø = not affected, ? = missing data

Powered by Codecov. Last update 33610c6...32f39f7. Read the comment docs.

TRANS_BY_GPT3

Copy link
Contributor

@chen-guanghua chen-guanghua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add TODO for rtc client statistic use rtmp client type

@duiniuluantanqin
Copy link
Member Author

add TODO for rtc client statistic use rtmp client type

add SrsRtcConnPlay and SrsRtcConnPublish

// update the statistic when client discoveried.
SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(cid_.c_str(), req_, session_, SrsRtcConnPlay)) != srs_success) {
srs_trace("webrtc: add client failed!");
Copy link
Member

@winlinvip winlinvip Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can this err be ignored?
  2. Even if it is ignored, srs_freep(err) should still be done to avoid memory leaks.

TRANS_BY_GPT3

Copy link
Member Author

@duiniuluantanqin duiniuluantanqin Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on_client always returns srs_success, which can be ignored.
However, for the sake of code consistency, I will still change it to wrap.

TRANS_BY_GPT3

@@ -1628,7 +1628,9 @@ SrsResponse::~SrsResponse()
string srs_client_type_string(SrsRtmpConnType type)
{
switch (type) {
case SrsRtmpConnPlay: return "Play";
case SrsRtmpConnPlay:
Copy link
Member

@winlinvip winlinvip Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to distinguish between these two and return rtmp-play and rtc-play?

TRANS_BY_GPT3

Copy link
Member Author

@duiniuluantanqin duiniuluantanqin Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At present, this field is not being used, but it can still be distinguished.

TRANS_BY_GPT3

@@ -486,6 +486,9 @@ class SrsRtcConnection : public ISrsResource, public ISrsDisposingHandler
public:
virtual const SrsContextId& get_id();
virtual std::string desc();
// Interface ISrsExpire.
public:
virtual void expire();
Copy link
Member

@winlinvip winlinvip Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface supports kickoff. We need to test if there will be any issues.

        client->conn->expire();
        srs_warn("kickoff client id=%s ok", client_id.c_str());

TRANS_BY_GPT3

Copy link
Member Author

@duiniuluantanqin duiniuluantanqin Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is used for the kickoff feature. I have tested it locally and it passed.

TRANS_BY_GPT3

srs_parse_rtmp_url(streamurl, tcUrl, stream_name);

int port;
string schema, host, vhost, param;
Copy link
Member

@winlinvip winlinvip Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many scattered local variables, which can easily lead to misuse.
Can we move the declaration of SrsRtcUserConfig ruc; forward and directly use its variable, for example:

SrsRtcUserConfig ruc;
if (true) {
    srs_parse_rtmp_url(streamurl, tcUrl, ruc.stream);

TRANS_BY_GPT3

Copy link
Member Author

@duiniuluantanqin duiniuluantanqin Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll make some changes.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title update statistic info for rtc(srs_app_rtc_api.cpp不合并方案) RTC: Support statistic for HTTP-API, HTTP-Callback and Security. Jul 24, 2021
@winlinvip winlinvip changed the title RTC: Support statistic for HTTP-API, HTTP-Callback and Security. RTC: Support statistic for HTTP-API, HTTP-Callback and Security Jul 24, 2021
@winlinvip winlinvip merged commit 0efd7b1 into ossrs:develop Jul 24, 2021
winlinvip pushed a commit that referenced this pull request Jul 24, 2021
… v4.0.144

* commit message for your changes. Lines starting

* Update srs_app_rtc_api.cpp

* add SrsRtcConnPlay and SrsRtcConnPublish, in enum SrsRtmpConnType

* Update srs_rtmp_stack.cpp

* Update srs_app_rtc_conn.cpp

* Update srs_app_rtc_api.cpp

* update utest

* Update srs_utest_app.cpp
winlinvip added a commit to winlinvip/srs that referenced this pull request Jul 24, 2021
winlinvip added a commit to winlinvip/srs that referenced this pull request Jul 24, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants