update src/Common/MediaSource.cpp.

This commit is contained in:
Leon 2022-06-08 08:48:14 +00:00 committed by Gitee
parent 2f2868fab3
commit c0e2257506
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * 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); 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) { void MediaSource::onReaderChanged(int size) {
auto listener = _listener.lock(); auto listener = _listener.lock();
if (listener) { 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) { bool MediaSourceEventInterceptor::setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path, size_t max_second) {
auto listener = _listener.lock(); auto listener = _listener.lock();
if (!listener) { if (!listener) {