mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
RTC: Generate timestamp only when transcode opus to aac.
This commit is contained in:
parent
2c1bd6da3e
commit
cf738754ae
4 changed files with 6 additions and 7 deletions
|
@ -494,11 +494,8 @@ SrsRtcPlayer::SrsRtcPlayer(SrsRtcSession* s, int parent_cid)
|
|||
|
||||
session_ = s;
|
||||
|
||||
audio_timestamp = 0;
|
||||
audio_sequence = 0;
|
||||
|
||||
video_sequence = 0;
|
||||
|
||||
mw_msgs = 0;
|
||||
realtime = true;
|
||||
|
||||
|
@ -711,15 +708,12 @@ srs_error_t SrsRtcPlayer::send_packets(SrsRtcSource* source, const vector<SrsRtp
|
|||
if (pkt->is_audio()) {
|
||||
info.nn_audios++;
|
||||
|
||||
pkt->header.set_timestamp(audio_timestamp);
|
||||
pkt->header.set_sequence(audio_sequence++);
|
||||
pkt->header.set_ssrc(audio_ssrc);
|
||||
pkt->header.set_payload_type(audio_payload_type);
|
||||
|
||||
// TODO: FIXME: Padding audio to the max payload in RTP packets.
|
||||
|
||||
// TODO: FIXME: Why 960? Need Refactoring?
|
||||
audio_timestamp += 960;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,6 @@ protected:
|
|||
private:
|
||||
// TODO: FIXME: How to handle timestamp overflow?
|
||||
// Information for audio.
|
||||
uint32_t audio_timestamp;
|
||||
uint16_t audio_sequence;
|
||||
uint32_t audio_ssrc;
|
||||
uint16_t audio_payload_type;
|
||||
|
|
|
@ -424,6 +424,7 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
|
|||
discard_bframe = false;
|
||||
merge_nalus = false;
|
||||
meta = new SrsMetaCache();
|
||||
audio_timestamp = 0;
|
||||
}
|
||||
|
||||
SrsRtcFromRtmpBridger::~SrsRtcFromRtmpBridger()
|
||||
|
@ -592,6 +593,10 @@ srs_error_t SrsRtcFromRtmpBridger::package_opus(char* data, int size, SrsRtpPack
|
|||
SrsRtpPacket2* pkt = new SrsRtpPacket2();
|
||||
pkt->frame_type = SrsFrameTypeAudio;
|
||||
pkt->header.set_marker(true);
|
||||
pkt->header.set_timestamp(audio_timestamp);
|
||||
|
||||
// TODO: FIXME: Why 960? Need Refactoring?
|
||||
audio_timestamp += 960;
|
||||
|
||||
SrsRtpRawPayload* raw = new SrsRtpRawPayload();
|
||||
pkt->payload = raw;
|
||||
|
|
|
@ -173,6 +173,7 @@ private:
|
|||
SrsAudioRecode* codec;
|
||||
bool discard_bframe;
|
||||
bool merge_nalus;
|
||||
uint32_t audio_timestamp;
|
||||
public:
|
||||
SrsRtcFromRtmpBridger(SrsRtcSource* source);
|
||||
virtual ~SrsRtcFromRtmpBridger();
|
||||
|
|
Loading…
Reference in a new issue