Skip to content

Commit

Permalink
update to v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shixuemei committed Aug 2, 2016
1 parent bf57908 commit e4cef1d
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 21 deletions.
4 changes: 2 additions & 2 deletions KSYGPULiveDy_iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'KSYGPULiveDy_iOS'
spec.version = '1.5.4.0'
spec.version = '1.6.0'
spec.license = {
:type => 'Proprietary',
:text => <<-LICENSE
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |spec|
spec.frameworks = 'VideoToolbox'
spec.dependency 'GPUImage'
spec.ios.library = 'z', 'iconv', 'stdc++.6'
spec.source = { :git => 'https://github.com/ksvc/KSYLive_iOS.git', :tag => 'v1.5.4.0'}
spec.source = { :git => 'https://github.com/ksvc/KSYLive_iOS.git', :tag => 'v1.6.0'}
spec.preserve_paths = 'framework/livegpu/libksygpulivedylib.framework'
spec.public_header_files = 'framework/livegpu/libksygpulivedylib.framework/Headers'
spec.vendored_frameworks = 'framework/livegpu/libksygpulivedylib.framework'
Expand Down
4 changes: 2 additions & 2 deletions KSYGPULive_iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'KSYGPULive_iOS'
spec.version = '1.5.4'
spec.version = '1.6.0'
spec.license = {
:type => 'Proprietary',
:text => <<-LICENSE
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |spec|
spec.frameworks = 'VideoToolbox'
spec.dependency 'GPUImage'
spec.ios.library = 'z', 'iconv', 'stdc++.6'
spec.source = { :git => 'https://github.com/ksvc/KSYLive_iOS.git', :tag => 'v1.5.4'}
spec.source = { :git => 'https://github.com/ksvc/KSYLive_iOS.git', :tag => 'v1.6.0'}
spec.vendored_frameworks = 'framework/livegpu/libksygpulive.framework'
end

18 changes: 12 additions & 6 deletions demo/KSYLiveDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
06FBBD6A1D2E17E00065ED55 /* KSYUIVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 06FBBD481D2E17E00065ED55 /* KSYUIVC.m */; };
06FBBD6B1D2E17E00065ED55 /* KSYUIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 06FBBD4A1D2E17E00065ED55 /* KSYUIView.m */; };
06FBBD6C1D2E17E00065ED55 /* KSYUIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 06FBBD4A1D2E17E00065ED55 /* KSYUIView.m */; };
584AD2C11D4F6649001CA44A /* KSYFileSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 060AE9C41D4653010064DD65 /* KSYFileSelector.m */; };
584AD2C71D4F79F5001CA44A /* libksygpulivedylib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 584AD2C61D4F79F5001CA44A /* libksygpulivedylib.framework */; };
584AD2C91D4F7A08001CA44A /* libksygpulivedylib.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 584AD2C81D4F7A08001CA44A /* libksygpulivedylib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
58C462AE1D3C76E0001BC26A /* KSYProberVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C462AD1D3C76E0001BC26A /* KSYProberVC.m */; };
58C462B01D3C7E23001BC26A /* KSYProberVC.m in Frameworks */ = {isa = PBXBuildFile; fileRef = 58C462AD1D3C76E0001BC26A /* KSYProberVC.m */; };
58C462B31D3C808A001BC26A /* KSYProberVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C462AD1D3C76E0001BC26A /* KSYProberVC.m */; };
Expand All @@ -75,9 +78,7 @@
5E231D411D22CF870064F77E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 06B2B1B31BE8F0D900E0CC85 /* Main.storyboard */; };
5E231D421D22CF870064F77E /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 06B2B1B81BE8F0D900E0CC85 /* LaunchScreen.xib */; };
5E231D431D22CF870064F77E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 06B2B1B61BE8F0D900E0CC85 /* Images.xcassets */; };
5E72AEC01D22D0FC00F22AFF /* libksygpulivedylib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E72AEBF1D22D0FC00F22AFF /* libksygpulivedylib.framework */; };
5E72AEC11D22D10200F22AFF /* libksygpulivedylib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E72AEBF1D22D0FC00F22AFF /* libksygpulivedylib.framework */; };
5E72AEC21D22D10200F22AFF /* libksygpulivedylib.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5E72AEBF1D22D0FC00F22AFF /* libksygpulivedylib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
625EF3B51C9A95BE00DBA1CC /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 625EF3B41C9A95BE00DBA1CC /* libsqlite3.tbd */; };
627FB6231CA2EEDB0029AD04 /* GPUImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 627FB6221CA2EEDB0029AD04 /* GPUImage.framework */; };
95B4A3EF1CBF6CC700CB6804 /* KSYSQLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 95B4A3EA1CBF6CC700CB6804 /* KSYSQLite.m */; };
Expand All @@ -97,7 +98,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
5E72AEC21D22D10200F22AFF /* libksygpulivedylib.framework in Embed Frameworks */,
584AD2C91D4F7A08001CA44A /* libksygpulivedylib.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -158,6 +159,8 @@
06FBBD481D2E17E00065ED55 /* KSYUIVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSYUIVC.m; sourceTree = "<group>"; };
06FBBD491D2E17E00065ED55 /* KSYUIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSYUIView.h; sourceTree = "<group>"; };
06FBBD4A1D2E17E00065ED55 /* KSYUIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSYUIView.m; sourceTree = "<group>"; };
584AD2C61D4F79F5001CA44A /* libksygpulivedylib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libksygpulivedylib.framework; path = ../framework/livegpu/libksygpulivedylib.framework; sourceTree = "<group>"; };
584AD2C81D4F7A08001CA44A /* libksygpulivedylib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libksygpulivedylib.framework; path = ../framework/livegpu/libksygpulivedylib.framework; sourceTree = "<group>"; };
58C462AD1D3C76E0001BC26A /* KSYProberVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KSYProberVC.m; path = KSYLiveDemo/KSYProberVC.m; sourceTree = "<group>"; };
58C462AF1D3C772F001BC26A /* KSYProberVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KSYProberVC.h; path = KSYLiveDemo/KSYProberVC.h; sourceTree = "<group>"; };
5E231D471D22CF870064F77E /* KSYLiveDemoDylib.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KSYLiveDemoDylib.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -201,8 +204,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
584AD2C71D4F79F5001CA44A /* libksygpulivedylib.framework in Frameworks */,
58C462B01D3C7E23001BC26A /* KSYProberVC.m in Frameworks */,
5E72AEC01D22D0FC00F22AFF /* libksygpulivedylib.framework in Frameworks */,
5E231D361D22CF870064F77E /* Security.framework in Frameworks */,
5E72AEC11D22D10200F22AFF /* libksygpulivedylib.framework in Frameworks */,
5E231D371D22CF870064F77E /* SystemConfiguration.framework in Frameworks */,
Expand Down Expand Up @@ -251,6 +254,8 @@
06B2B19A1BE8F0D900E0CC85 = {
isa = PBXGroup;
children = (
584AD2C81D4F7A08001CA44A /* libksygpulivedylib.framework */,
584AD2C61D4F79F5001CA44A /* libksygpulivedylib.framework */,
060AE9C21D4652CC0064DD65 /* Libs */,
06FBBD271D2E17E00065ED55 /* KSYDemoUI */,
067F7E4F1D4762AC00F54FEA /* KSYPlayer */,
Expand Down Expand Up @@ -499,6 +504,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
584AD2C11D4F6649001CA44A /* KSYFileSelector.m in Sources */,
58C462B31D3C808A001BC26A /* KSYProberVC.m in Sources */,
F296EC011D352B07001C4120 /* KSYMiscView.m in Sources */,
06FBBD581D2E17E00065ED55 /* KSYKitDemoVC.m in Sources */,
Expand Down Expand Up @@ -715,7 +721,7 @@
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
../build,
../framework/livegpu,
"$(PROJECT_DIR)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -751,7 +757,7 @@
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
../build,
../framework/livegpu,
"$(PROJECT_DIR)",
);
GCC_PREPROCESSOR_DEFINITIONS = "USING_DYNAMIC_FRAMEWORK=1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"22163F550B6D3983C932E7AFC70BD669DF066E1A" : 0,
"5F80F88490BD9C1963793C74EA979B472EBDFFF2" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "50A186CD-E02E-4F56-AD6F-1B92E688F10F",
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7347C4EB-61D4-448C-9C01-E5EA8BE65A9A",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"22163F550B6D3983C932E7AFC70BD669DF066E1A" : "KSYLive_iOS\/",
"5F80F88490BD9C1963793C74EA979B472EBDFFF2" : ".."
Expand Down
5 changes: 4 additions & 1 deletion demo/KSYLiveDemo/KSYDemoUI/KSYBlockDemoVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ - (void)viewDidLoad {
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.ctrlView.btnQuit setTitle: @"退出block"
forState: UIControlStateNormal];
if (self.capDev) {
self.filter = self.ksyFilterView.curFilter;
[self setupVideoPath];
Expand Down Expand Up @@ -270,7 +272,7 @@ - (void)setupPip{
//player
self.player = [[KSYMoviePlayerController alloc] initWithContentURL: self.ksyPipView.pipURL];
self.player.controlStyle = MPMovieControlStyleNone;
self.player.shouldUseHWCodec = YES;
self.player.videoDecoderMode = MPMovieVideoDecoderMode_Hardware;
self.player.shouldAutoplay = YES;
self.player.shouldMute = NO;
[self.aMixer setTrack:self.pipTrack enable:YES];
Expand Down Expand Up @@ -356,6 +358,7 @@ - (void)onMiscSwitch:(UISwitch *)sw{
[self.micMonitor stop];
}
}
[super onMiscSwitch:sw];
}

// 调节耳返音量
Expand Down
6 changes: 3 additions & 3 deletions demo/KSYLiveDemo/KSYDemoUI/KSYCtrlView.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ - (id) init {
// stat string formats
_lblStat.backgroundColor = [UIColor clearColor];
_lblStat.textColor = [UIColor redColor];
_lblStat.numberOfLines = 6;
_lblStat.numberOfLines = 7;
_lblStat.textAlignment = NSTextAlignmentLeft;
return self;
}
Expand All @@ -43,8 +43,8 @@ - (void) layoutUI {
[self putRow3:_btnCapture
and:nil
and:_btnStream];
self.btnH *= 5;
self.yPos -= (self.btnH+self.gap*2);
self.btnH *= 7;
self.yPos -= (self.btnH +self.gap*2);
[self putRow1:_lblStat];
}

Expand Down
4 changes: 2 additions & 2 deletions demo/KSYLiveDemo/KSYDemoUI/KSYGPUStreamerVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ - (IBAction)onPipNext:(id)sender {
_pipIdx = (_pipIdx+1)%_pipList.count;
_player = [[KSYMoviePlayerController alloc] initWithContentURL: videoUrl];
_player.controlStyle = MPMovieControlStyleNone;
_player.shouldUseHWCodec = YES;
_player.videoDecoderMode = MPMovieVideoDecoderMode_Hardware;
_player.shouldAutoplay = YES;
_player.shouldMute = NO;
__weak KSYGPUStreamerVC * vc = self;
Expand Down Expand Up @@ -797,7 +797,7 @@ - (void) setupPip{
_pipIdx = (_pipIdx+1)%_pipList.count;
_player = [[KSYMoviePlayerController alloc] initWithContentURL: videoUrl];
_player.controlStyle = MPMovieControlStyleNone;
_player.shouldUseHWCodec = YES;
_player.videoDecoderMode = MPMovieVideoDecoderMode_Hardware;
_player.shouldAutoplay = YES;
_player.shouldMute = NO;

Expand Down
3 changes: 3 additions & 0 deletions demo/KSYLiveDemo/KSYDemoUI/KSYKitDemoVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ - (void)viewDidLoad {

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.ctrlView.btnQuit setTitle: @"退出kit"
forState: UIControlStateNormal];
if (_kit) {
// init with default filter
self.filter =self.ksyFilterView.curFilter;
Expand Down Expand Up @@ -237,6 +239,7 @@ - (void)onMiscSwitch:(UISwitch *)sw{
[_kit.micMonitor stop];
}
}
[super onMiscSwitch:sw];
}

// 调节耳返音量
Expand Down
2 changes: 0 additions & 2 deletions demo/KSYLiveDemo/KSYDemoUI/KSYMiscView.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ - (id)init{
_btn2 = [self addButton:@"filter截图"];
_micmVol = [self addSliderName:@"耳返音量" From:0.0 To:1.0 Init:1.0];
_micmMix = [self addSwitch:NO]; // default to NO

return self;
}

Expand All @@ -38,7 +37,6 @@ - (void)layoutUI{

[self putSlider:_micmVol
andSwitch:_micmMix];

}

- (void) initMicmOutput {
Expand Down
2 changes: 2 additions & 0 deletions demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ typedef struct _StreamState {
- (void)onReverbType:(UISegmentedControl *)seg;
//pip
- (void)onPipStop;
//pure audio stream
- (void)onMiscSwitch:(UISwitch *)sw;
@end
6 changes: 5 additions & 1 deletion demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,14 @@ - (void)onTimer:(NSTimer *)theTimer{
NSString* statekbps = [NSString stringWithFormat:@"实时码率(kbps):%4.1f A%4.1f V%4.1f\n", realTKbps, [_streamerBase encodeAKbps], [_streamerBase encodeVKbps] ];
NSString* statefps = [NSString stringWithFormat:@"实时帧率%2.1f fps 总上传:%@\n", encFps, uploadDateSize ];
NSString* statedrop = [NSString stringWithFormat:@"丢帧 %4d | %3.1f | %2.1f%% \n", curState.droppedVFrames, dropRate, dropPercent ];
NSString* netEvent = [NSString stringWithFormat:@"网络事件 %d bad | %d raise | %d drop", _notGoodCnt, _raiseCnt, _dropCnt];
NSString* netEvent = [NSString stringWithFormat:@"网络事件 %d bad | %d raise | %d drop\n", _notGoodCnt, _raiseCnt, _dropCnt];
NSString *cpu_use = [NSString stringWithFormat:@"cpu_use: %.2f",[self cpu_usage]];
UILabel *stat = _ctrlView.lblStat;
stat.text = [ stateurl stringByAppendingString:statekbps ];
stat.text = [ stat.text stringByAppendingString:statefps ];
stat.text = [ stat.text stringByAppendingString:statedrop ];
stat.text = [ stat.text stringByAppendingString:netEvent ];
stat.text = [ stat.text stringByAppendingString:cpu_use ];
}
if (_bgmPlayer && _bgmPlayer.bgmPlayerState ==KSYBgmPlayerStatePlaying ) {
_ksyBgmView.progressV.progress = _bgmPlayer.bgmProcess;
Expand All @@ -375,6 +377,7 @@ - (void) onBasicCtrl: (id) btn {
[self onStream];
}
}

//menuView control
- (void)onMenuBtnPress:(UIButton *)btn{
KSYUIView * view = nil;
Expand Down Expand Up @@ -597,6 +600,7 @@ - (void)saveImage: (UIImage *)image

#pragma mark - micMonitor
- (void)onMiscSwitch:(UISwitch *)sw{ // see kit & block

}
- (void)onMiscSlider:(KSYNameSlider *)slider { // see kit & block
}
Expand Down
3 changes: 2 additions & 1 deletion demo/KSYLiveDemo/KSYPlayerVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ - (IBAction)onPlayVideo:(id)sender {
if(content_mode > MPMovieScalingModeFill)
content_mode = MPMovieScalingModeNone;

_player.shouldUseHWCodec = switchHwCodec.isOn;
_player.videoDecoderMode = switchHwCodec.isOn? MPMovieVideoDecoderMode_Hardware : MPMovieVideoDecoderMode_Software;
// _player.videoDecoderMode = MPMovieVideoDecoderMode_AUTO;
_player.shouldMute = switchMute.isOn;
_player.shouldEnableKSYStatModule = TRUE;
_player.shouldLoop = NO;
Expand Down
2 changes: 2 additions & 0 deletions demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@
- (NSString*) sizeFormatted : (int )KB;
- (NSString *)timeFormatted:(int)totalSeconds;
- (void) toast:(NSString*)message;
//cpu use rate
-(float) cpu_usage;
@end
62 changes: 62 additions & 0 deletions demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "KSYUIVC.h"
#import <mach/mach.h>

@interface KSYUIVC() {

Expand Down Expand Up @@ -91,5 +92,66 @@ - (void) toast:(NSString*)message{
});
}

-(float) cpu_usage
{
kern_return_t kr;
task_info_data_t tinfo;
mach_msg_type_number_t task_info_count;

task_info_count = TASK_INFO_MAX;
kr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)tinfo, &task_info_count);
if (kr != KERN_SUCCESS) {
return -1;
}

task_basic_info_t basic_info;
thread_array_t thread_list;
mach_msg_type_number_t thread_count;

thread_info_data_t thinfo;
mach_msg_type_number_t thread_info_count;

thread_basic_info_t basic_info_th;
uint32_t stat_thread = 0; // Mach threads

basic_info = (task_basic_info_t)tinfo;

// get threads in the task
kr = task_threads(mach_task_self(), &thread_list, &thread_count);
if (kr != KERN_SUCCESS) {
return -1;
}
if (thread_count > 0)
stat_thread += thread_count;

long tot_sec = 0;
long tot_usec = 0;
float tot_cpu = 0;
int j;

for (j = 0; j < thread_count; j++)
{
thread_info_count = THREAD_INFO_MAX;
kr = thread_info(thread_list[j], THREAD_BASIC_INFO,
(thread_info_t)thinfo, &thread_info_count);
if (kr != KERN_SUCCESS) {
return -1;
}

basic_info_th = (thread_basic_info_t)thinfo;

if (!(basic_info_th->flags & TH_FLAGS_IDLE)) {
tot_sec = tot_sec + basic_info_th->user_time.seconds + basic_info_th->system_time.seconds;
tot_usec = tot_usec + basic_info_th->system_time.microseconds + basic_info_th->system_time.microseconds;
tot_cpu = tot_cpu + basic_info_th->cpu_usage / (float)TH_USAGE_SCALE * 100.0;
}

} // for each thread

kr = vm_deallocate(mach_task_self(), (vm_offset_t)thread_list, thread_count * sizeof(thread_t));
assert(kr == KERN_SUCCESS);

return tot_cpu;
}

@end

0 comments on commit e4cef1d

Please sign in to comment.