1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: We should cache the sps/pps in source.

This commit is contained in:
winlin 2020-05-13 16:21:42 +08:00
parent 68de796f77
commit b8b52f28f5
3 changed files with 91 additions and 30 deletions

View file

@ -120,6 +120,8 @@ private:
SrsRtcPublisher* rtc_publisher_;
// Transmux RTMP to RTC.
SrsRtcFromRtmpBridger* bridger_;
// The metadata cache.
SrsMetaCache* meta;
private:
// To delivery stream to clients.
std::vector<SrsRtcConsumer*> consumers;
@ -139,6 +141,8 @@ public:
virtual int pre_source_id();
// Get the bridger.
ISrsSourceBridger* bridger();
// For RTC, we need to package SPS/PPS(in cached meta) before each IDR.
SrsMetaCache* cached_meta();
public:
// Create consumer
// @param consumer, output the create consumer.
@ -165,6 +169,11 @@ public:
virtual srs_error_t on_video(SrsCommonMessage* video);
virtual srs_error_t on_audio_imp(SrsSharedPtrMessage* audio);
virtual srs_error_t on_video_imp(SrsSharedPtrMessage* video);
private:
// The format, codec information.
// TODO: FIXME: Remove it.
SrsRtmpFormat* format;
srs_error_t filter(SrsSharedPtrMessage* shared_video, SrsFormat* format);
};
class SrsRtcFromRtmpBridger : public ISrsSourceBridger
@ -172,8 +181,6 @@ class SrsRtcFromRtmpBridger : public ISrsSourceBridger
private:
SrsRequest* req;
SrsRtcSource* source_;
// The metadata cache.
SrsMetaCache* meta;
// The format, codec information.
SrsRtmpFormat* format;
private:
@ -185,8 +192,6 @@ public:
virtual ~SrsRtcFromRtmpBridger();
public:
virtual srs_error_t initialize(SrsRequest* r);
// For RTC, we need to package SPS/PPS(in cached meta) before each IDR.
SrsMetaCache* cached_meta();
virtual srs_error_t on_publish();
virtual void on_unpublish();
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio);