feat: add broadcast event for player count change
This commit is contained in:
parent
968f6c69c3
commit
56e840efcd
|
|
@ -652,6 +652,7 @@ MediaSource::Ptr MediaSource::createFromMP4(const string &schema, const string &
|
||||||
/////////////////////////////////////MediaSourceEvent//////////////////////////////////////
|
/////////////////////////////////////MediaSourceEvent//////////////////////////////////////
|
||||||
|
|
||||||
void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
|
void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
|
||||||
|
NOTICE_EMIT(BroadcastPlayerCountChangedArgs, Broadcast::kBroadcastPlayerCountChanged, sender.getMediaTuple(), sender.totalReaderCount());
|
||||||
if (size || sender.totalReaderCount()) {
|
if (size || sender.totalReaderCount()) {
|
||||||
//还有人观看该视频,不触发关闭事件
|
//还有人观看该视频,不触发关闭事件
|
||||||
_async_close_timer = nullptr;
|
_async_close_timer = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ const string kBroadcastRtcSctpFailed = "kBroadcastRtcSctpFailed";
|
||||||
const string kBroadcastRtcSctpClosed = "kBroadcastRtcSctpClosed";
|
const string kBroadcastRtcSctpClosed = "kBroadcastRtcSctpClosed";
|
||||||
const string kBroadcastRtcSctpSend = "kBroadcastRtcSctpSend";
|
const string kBroadcastRtcSctpSend = "kBroadcastRtcSctpSend";
|
||||||
const string kBroadcastRtcSctpReceived = "kBroadcastRtcSctpReceived";
|
const string kBroadcastRtcSctpReceived = "kBroadcastRtcSctpReceived";
|
||||||
|
const string kBroadcastPlayerCountChanged = "kBroadcastPlayerCountChanged";
|
||||||
|
|
||||||
} // namespace Broadcast
|
} // namespace Broadcast
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,10 @@ extern const std::string kBroadcastRtcSctpSend;
|
||||||
extern const std::string kBroadcastRtcSctpReceived;
|
extern const std::string kBroadcastRtcSctpReceived;
|
||||||
#define BroadcastRtcSctpReceivedArgs WebRtcTransport& sender, uint16_t &streamId, uint32_t &ppid, const uint8_t *&msg, size_t &len
|
#define BroadcastRtcSctpReceivedArgs WebRtcTransport& sender, uint16_t &streamId, uint32_t &ppid, const uint8_t *&msg, size_t &len
|
||||||
|
|
||||||
|
// 观看人数变化广播
|
||||||
|
extern const std::string kBroadcastPlayerCountChanged;
|
||||||
|
#define BroadcastPlayerCountChangedArgs const MediaTuple& args, int count
|
||||||
|
|
||||||
#define ReloadConfigTag ((void *)(0xFF))
|
#define ReloadConfigTag ((void *)(0xFF))
|
||||||
#define RELOAD_KEY(arg, key) \
|
#define RELOAD_KEY(arg, key) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue