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

Transmux RTC to RTMP. #2252

Closed
wants to merge 6 commits into from
Closed

Transmux RTC to RTMP. #2252

wants to merge 6 commits into from

Conversation

hu-ping
Copy link

@hu-ping hu-ping commented Mar 21, 2021

Hello srs maintainer:
The functionality of converting RTC to RTMP has been implemented based on the concept of srs birdger. This includes transcoding opus to aac and using jitter buffer to frame h264.

Issue:
#2200


TRANS_BY_GPT3

@codecov-io
Copy link

codecov-io commented Mar 21, 2021

Codecov Report

Merging #2252 (0f02ab5) into develop (7c2cc4f) will decrease coverage by 0.44%.
The diff coverage is 0.00%.

❗ Current head 0f02ab5 differs from pull request most recent head bb0a7bd. Consider uploading reports for the commit bb0a7bd to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2252      +/-   ##
===========================================
- Coverage    55.55%   55.11%   -0.45%     
===========================================
  Files          126      126              
  Lines        55494    55887     +393     
===========================================
- Hits         30832    30801      -31     
- Misses       24662    25086     +424     

| Impacted Files | Coverage Δ | |'

'| Impacted Files | Coverage Δ | |
|---|---|---|
| trunk/src/app/srs_app_config.cpp | 64.69% <0.00%> (-0.16%) | ⬇️ |
| trunk/src/app/srs_app_config.hpp | 100.00% <ø> (ø) | |
| trunk/src/app/srs_app_rtc_codec.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_jitbuffer.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_jitbuffer.hpp | 0.00% <ø> (ø) | |
| trunk/src/app/srs_app_rtc_source.cpp | 9.13% <0.00%> (-3.06%) | ⬇️ |
| trunk/src/app/srs_app_rtc_source.hpp | 0.00% <ø> (ø) | |
| trunk/src/app/srs_app_source.cpp | 0.74% <0.00%> (-0.01%) | ⬇️ |
| trunk/src/kernel/srs_kernel_rtc_rtp.hpp | 27.69% <0.00%> (-0.44%) | ⬇️ |
| trunk/src/app/srs_app_rtc_dtls.cpp | 69.77% <0.00%> (-0.21%) | ⬇️ |
| ... and 1 more | |


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c2cc4f...bb0a7bd. Read the comment docs.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title Rtctortmp Transmux RTC to RTMP. Mar 21, 2021
@@ -1,9 +1,11 @@
static const AVCodec * const codec_list[] = {
&ff_aac_encoder,
&ff_opus_encoder,
&ff_libfdk_aac_encoder,
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

FDK aac has a LICENSE issue, I remember it is GPL or something like that, SRS cannot use this LICENSE.
At most, SRS can only use LGPL and link it with so library. Of course, there is no problem with Apache, BSD, and MIT licenses.

TRANS_BY_GPT3

Copy link
Author

@hu-ping hu-ping Apr 21, 2021

Choose a reason for hiding this comment

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

Is that to say that the source code of fdk aac cannot be used to compile ffmpeg, and instead we need to use the .so library to compile ffmpeg, and then call fdk aac through ffmpeg's interface?

TRANS_BY_GPT3

codec_ctx_->frame_size = frame_->nb_samples;
}

if (SrsAudioCodecIdAAC == codec_id_) {
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

This logic seems to be somewhat unreasonable. Does FFmpeg have a corresponding function to implement copying?

TRANS_BY_GPT3

@@ -416,6 +432,10 @@ SrsAudioRecode::SrsAudioRecode(SrsAudioCodecId src_codec, SrsAudioCodecId dst_co
dec_ = NULL;
enc_ = NULL;
resample_ = NULL;

fw_audio_dec = new SrsFileWriter();
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

Debug code?

TRANS_BY_GPT3

@@ -1273,6 +1275,157 @@ SrsRtpFrameBufferEnum SrsRtpJitterBuffer::InsertPacket(uint16_t seq, uint32_t ts
return buffer_state;
}


#if 1
SrsRtpFrameBufferEnum SrsRtpJitterBuffer::InsertPacket2(const SrsRtpPacket2 *pkt, const char*nalu, int nalu_len,
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

Debug code?

TRANS_BY_GPT3

}


//TODO:huping modify.
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

Why is it commented out?

TRANS_BY_GPT3

@@ -498,6 +499,7 @@ class ISrsSourceBridger
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio) = 0;
virtual srs_error_t on_video(SrsSharedPtrMessage* video) = 0;
virtual void on_unpublish() = 0;
virtual srs_error_t on_rtp(SrsRtpPacket2* pkt) = 0;
Copy link
Member

@winlinvip winlinvip Apr 14, 2021

Choose a reason for hiding this comment

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

on_audio/on_video is the frame processing function for RTMP.
on_rtp is the packet processing function for RTP.
It is not ideal to have these two APIs together.

TRANS_BY_GPT3

@winlinvip winlinvip closed this Apr 23, 2021
@winlinvip
Copy link
Member

Fixed by #2303

@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.

3 participants