回调播放器debug info

This commit is contained in:
Caleb
2026-03-02 17:42:17 +08:00
parent a9e97d56cb
commit 5020a6afc4
5 changed files with 76 additions and 0 deletions

View File

@@ -713,6 +713,21 @@
} }
} }
- (void)player:(SellyLiveVideoPlayer *)player onDebugInfo:(SellyLivePlayerStats *)stats {
NSLog(@"统计信息: 协议=%@, CPU=%ld%%/%ld%%, FPS=%ld, 码率=%ldkbps/%ldkbps, RTT=%ldms ,freezeTime=%ldms, 分辨率=%@, 丢包率=%.2f%% timestampMs=%lld",
stats.protocol,
stats.appCpu,
stats.systemCpu,
stats.fps,
stats.videoBitrate,
stats.audioBitrate,
stats.rtt,
stats.freezeTime,
NSStringFromCGSize(stats.videoSize),
stats.packetLossRate,
stats.timestampMs);
}
#pragma mark - Screenshot #pragma mark - Screenshot
- (void)saveCurrentFrameToPhotoAlbum:(UIImage *)image { - (void)saveCurrentFrameToPhotoAlbum:(UIImage *)image {

View File

@@ -13,6 +13,7 @@
#import "SellyCloudSDKError.h" #import "SellyCloudSDKError.h"
#import "SellyLiveAudioConfiguration.h" #import "SellyLiveAudioConfiguration.h"
#import "SellyLivePlayerDelegate.h" #import "SellyLivePlayerDelegate.h"
#import "SellyLivePlayerStats.h"
#import "SellyLivePusherDelegate.h" #import "SellyLivePusherDelegate.h"
#import "SellyLivePusherStats.h" #import "SellyLivePusherStats.h"
#import "SellyLiveVideoConfiguration.h" #import "SellyLiveVideoConfiguration.h"

View File

@@ -9,6 +9,7 @@
#import "SellyPublicDefinition.h" #import "SellyPublicDefinition.h"
#import "SellyLiveVideoPlayer.h" #import "SellyLiveVideoPlayer.h"
#import "SellyRTCVideoFrame.h" #import "SellyRTCVideoFrame.h"
#import "SellyLivePlayerStats.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -55,6 +56,14 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
- (BOOL)player:(SellyLiveVideoPlayer *)player onRenderVideoFrame:(SellyRTCVideoFrame *)videoFrame; - (BOOL)player:(SellyLiveVideoPlayer *)player onRenderVideoFrame:(SellyRTCVideoFrame *)videoFrame;
/**
播放器调试信息回调
@param player 播放器实例
@param stats 播放器统计信息,包含各种性能指标和调试数据
*/
- (void)player:(SellyLiveVideoPlayer *)player onDebugInfo:(SellyLivePlayerStats *)stats;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,51 @@
//
// SellyLivePlayerStats.h
// SellyCloudSDK
//
// Created by Caleb on 26/1/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyLivePlayerStats : NSObject <NSCopying>
/// 播放协议RTMP/HLS/WebRTC等
@property (nonatomic, strong) NSString *protocol;
/// App / System CPU%
@property (nonatomic, assign) NSUInteger appCpu;
@property (nonatomic, assign) NSUInteger systemCpu;
/// 视频帧率fps
@property (nonatomic, assign) NSInteger fps;
/// 视频 / 音频码率kbps
@property (nonatomic, assign) NSInteger videoBitrate;
@property (nonatomic, assign) NSInteger audioBitrate;
/// 总下行速率kbps等于 videoBitrate + audioBitrate
@property (nonatomic, assign) NSInteger netSpeed;
/// RTT - 往返时延ms
@property (nonatomic, assign) NSInteger rtt;
/// 视频分辨率
@property (nonatomic, assign) CGSize videoSize;
/// 快照时间ms since boot
@property (nonatomic, assign) uint64_t timestampMs;
/// 是否正在loading
@property (nonatomic, assign) BOOL isLoading;
/// 丢包率(%
@property (nonatomic, assign) CGFloat packetLossRate;
/// 卡顿时间ms- 统计周期内的累积卡顿时长
@property (nonatomic, assign) NSUInteger freezeTime;
@end
NS_ASSUME_NONNULL_END