From c0e225750659df1385efbca3454eb1990fe6ef2b Mon Sep 17 00:00:00 2001 From: Leon <8544842+leon14631@user.noreply.gitee.com> Date: Wed, 8 Jun 2022 08:48:14 +0000 Subject: [PATCH] update src/Common/MediaSource.cpp. --- src/Common/MediaSource.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 6b395c18..d2de4b9a 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). @@ -213,6 +213,14 @@ bool MediaSource::close(bool force) { return listener->close(*this,force); } +int MediaSource::getLossRate(mediakit::TrackType type) { + auto listener = _listener.lock(); + if (!listener) { + return -1; + } + return listener->getLossRate(*this, type); +} + void MediaSource::onReaderChanged(int size) { auto listener = _listener.lock(); if (listener) { @@ -690,6 +698,14 @@ void MediaSourceEventInterceptor::onRegist(MediaSource &sender, bool regist) { } } +int MediaSourceEventInterceptor::getLossRate(MediaSource &sender, TrackType type){ + auto listener = _listener.lock(); + if (listener) { + return listener->getLossRate(sender, type); + } + return -1; //异常返回-1 +} + bool MediaSourceEventInterceptor::setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path, size_t max_second) { auto listener = _listener.lock(); if (!listener) {