Compare commits

..

39 Commits

Author SHA1 Message Date
toss156 458759db08 rename h264 encode lib to avoid duplicate symbol error 2016-08-03 23:17:10 +08:00
Justin 408e6e17f5 Update LFLiveKit.podspec
fix issue  #36 关于use_frameworks!的问题
2016-08-03 23:16:38 +08:00
琨君 24e6c4576b change the AVAudioSession Category before start, or it will fail 2016-08-03 23:16:38 +08:00
chenliming 7a901b8b36 update.. 2016-08-03 23:16:37 +08:00
chenliming 6cf68fb370 update 2016-08-03 23:16:37 +08:00
chenliming 96f4415f1d update .. 2016-08-03 23:16:37 +08:00
chenliming f379e59a01 add a icon 2016-08-03 23:16:37 +08:00
chenliming 542d8b88d5 update read 2016-08-03 23:16:37 +08:00
chenliming 9566b8ceb9 update readme 2016-08-03 23:16:37 +08:00
chenliming 1e7296c566 update 2016-08-03 23:16:37 +08:00
chenliming 3f3007531f modify read 2016-08-03 23:16:37 +08:00
chenliming 9381d6c79b modify read 2016-08-03 23:16:37 +08:00
chenliming 605b6bc8e8 update travis 2016-08-03 23:16:37 +08:00
chenliming 9bb160132d update read 2016-08-03 23:16:37 +08:00
chenliming 2ada466726 update version2.0 2016-08-03 23:16:37 +08:00
chenliming 11185e3a4d add iOS encoder 2016-08-03 23:16:37 +08:00
chenliming acefbb6e24 add carthage 2016-08-03 23:15:43 +08:00
chenliming c1787ef6c5 update version 2016-08-03 23:15:42 +08:00
chenliming 77b1776e41 update version 2016-08-03 23:13:39 +08:00
chenliming d460a1105e update... 2016-08-03 23:13:39 +08:00
chenliming c89eece287 update.... 2016-08-03 23:13:39 +08:00
chenliming 6c4fc9a98b update.... 2016-08-03 23:13:39 +08:00
chenliming 33070a53c7 update... 2016-08-03 23:13:39 +08:00
chenliming 2d4360fc1d update。。。 2016-08-03 23:13:39 +08:00
chenliming 272165c84c update.. 2016-08-03 23:13:39 +08:00
chenliming 322b74ae2e update... 2016-08-03 23:13:39 +08:00
chenliming 5ee942d4b0 support carthage 2016-08-03 23:13:38 +08:00
chenliming a7595aa776 modify podspec 2016-08-03 23:13:09 +08:00
chenliming 48098066be update version 2016-08-03 23:13:09 +08:00
chenliming 4cf864b79c update read 2016-08-03 23:13:09 +08:00
chenliming 677680fa3f modify readme 2016-08-03 23:13:09 +08:00
chenliming b72b44fece update podspec 2016-08-03 23:12:09 +08:00
chenliming d749db1ddc update version 2016-08-03 23:12:09 +08:00
chenliming 8c492b130e compile question 2016-08-03 23:10:45 +08:00
chenliming 40bc03438d modify cropSize 2016-08-03 23:09:49 +08:00
chenliming 1d53c484e2 modify black screen bug 2016-08-03 23:09:49 +08:00
chenliming e97513c78f modify bug https://github.com/LaiFengiOS/LFLiveKit/issues/11#issuecomment-235147191 2016-08-03 23:09:49 +08:00
chenliming 65619a256a modify bug https://github.com/LaiFengiOS/LFLiveKit/issues/22 2016-08-03 23:09:48 +08:00
小歪~~~ 9f73c10d29 Merge pull request #23 from toss156/master
rename h264 encode lib to avoid duplicate symbol error
2016-07-26 13:46:35 +08:00
32 changed files with 463 additions and 524 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
Pod::Spec.new do |s|
s.name = "LFLiveKit"
s.version = "2.1"
s.version = "2.0"
s.summary = "LaiFeng ios Live. LFLiveKit."
s.homepage = "https://github.com/chenliming777"
s.license = { :type => "MIT", :file => "LICENSE" }
+64 -60
View File
@@ -408,14 +408,6 @@
843725011D4F260A002B398B /* rtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 843723971D4F260A002B398B /* rtmp.c */; };
843725021D4F260A002B398B /* rtmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 843723981D4F260A002B398B /* rtmp.h */; };
843725031D4F260A002B398B /* rtmp_sys.h in Headers */ = {isa = PBXBuildFile; fileRef = 843723991D4F260A002B398B /* rtmp_sys.h */; };
B221C24F1D59D41A009615C3 /* LFAVEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B221C2471D59D41A009615C3 /* LFAVEncoder.h */; };
B221C2501D59D41A009615C3 /* LFAVEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B221C2481D59D41A009615C3 /* LFAVEncoder.mm */; };
B221C2511D59D41A009615C3 /* LFMP4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = B221C2491D59D41A009615C3 /* LFMP4Atom.h */; };
B221C2521D59D41A009615C3 /* LFMP4Atom.m in Sources */ = {isa = PBXBuildFile; fileRef = B221C24A1D59D41A009615C3 /* LFMP4Atom.m */; };
B221C2531D59D41A009615C3 /* LFNALUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B221C24B1D59D41A009615C3 /* LFNALUnit.cpp */; };
B221C2541D59D41A009615C3 /* LFNALUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = B221C24C1D59D41A009615C3 /* LFNALUnit.h */; };
B221C2551D59D41A009615C3 /* LFVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B221C24D1D59D41A009615C3 /* LFVideoEncoder.h */; };
B221C2561D59D41A009615C3 /* LFVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B221C24E1D59D41A009615C3 /* LFVideoEncoder.m */; };
B289F1DB1D3DE77F00D9C7A5 /* LFStreamingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D41D3DE77F00D9C7A5 /* LFStreamingBuffer.h */; };
B289F1DC1D3DE77F00D9C7A5 /* LFStreamingBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = B289F1D51D3DE77F00D9C7A5 /* LFStreamingBuffer.m */; };
B289F1DD1D3DE77F00D9C7A5 /* LFStreamRtmpSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D61D3DE77F00D9C7A5 /* LFStreamRtmpSocket.h */; };
@@ -423,7 +415,15 @@
B289F1DF1D3DE77F00D9C7A5 /* LFStreamSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D81D3DE77F00D9C7A5 /* LFStreamSocket.h */; };
B289F1E01D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D91D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h */; };
B289F1E11D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = B289F1DA1D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m */; };
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14621D45F18B008082E8 /* LFAVEncoder.h */; };
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */; };
B2CD146F1D45F18B008082E8 /* LICENSE.markdown in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14641D45F18B008082E8 /* LICENSE.markdown */; };
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14651D45F18B008082E8 /* LFMP4Atom.h */; };
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14661D45F18B008082E8 /* LFMP4Atom.m */; };
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */; };
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14681D45F18B008082E8 /* LFNALUnit.h */; };
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */; };
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */; };
B2CD14761D45F18B008082E8 /* LFH264VideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD146B1D45F18B008082E8 /* LFH264VideoEncoder.h */; };
B2CD14771D45F18B008082E8 /* LFH264VideoEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2CD146C1D45F18B008082E8 /* LFH264VideoEncoder.mm */; };
/* End PBXBuildFile section */
@@ -844,14 +844,6 @@
843723971D4F260A002B398B /* rtmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtmp.c; sourceTree = "<group>"; };
843723981D4F260A002B398B /* rtmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtmp.h; sourceTree = "<group>"; };
843723991D4F260A002B398B /* rtmp_sys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtmp_sys.h; sourceTree = "<group>"; };
B221C2471D59D41A009615C3 /* LFAVEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFAVEncoder.h; sourceTree = "<group>"; };
B221C2481D59D41A009615C3 /* LFAVEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LFAVEncoder.mm; sourceTree = "<group>"; };
B221C2491D59D41A009615C3 /* LFMP4Atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFMP4Atom.h; sourceTree = "<group>"; };
B221C24A1D59D41A009615C3 /* LFMP4Atom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFMP4Atom.m; sourceTree = "<group>"; };
B221C24B1D59D41A009615C3 /* LFNALUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LFNALUnit.cpp; sourceTree = "<group>"; };
B221C24C1D59D41A009615C3 /* LFNALUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFNALUnit.h; sourceTree = "<group>"; };
B221C24D1D59D41A009615C3 /* LFVideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFVideoEncoder.h; sourceTree = "<group>"; };
B221C24E1D59D41A009615C3 /* LFVideoEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFVideoEncoder.m; sourceTree = "<group>"; };
B289F1D41D3DE77F00D9C7A5 /* LFStreamingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LFStreamingBuffer.h; path = LFLiveKit/publish/LFStreamingBuffer.h; sourceTree = SOURCE_ROOT; };
B289F1D51D3DE77F00D9C7A5 /* LFStreamingBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LFStreamingBuffer.m; path = LFLiveKit/publish/LFStreamingBuffer.m; sourceTree = SOURCE_ROOT; };
B289F1D61D3DE77F00D9C7A5 /* LFStreamRtmpSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LFStreamRtmpSocket.h; path = LFLiveKit/publish/LFStreamRtmpSocket.h; sourceTree = SOURCE_ROOT; };
@@ -859,7 +851,15 @@
B289F1D81D3DE77F00D9C7A5 /* LFStreamSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LFStreamSocket.h; path = LFLiveKit/publish/LFStreamSocket.h; sourceTree = SOURCE_ROOT; };
B289F1D91D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+LFAdd.h"; path = "LFLiveKit/publish/NSMutableArray+LFAdd.h"; sourceTree = SOURCE_ROOT; };
B289F1DA1D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+LFAdd.m"; path = "LFLiveKit/publish/NSMutableArray+LFAdd.m"; sourceTree = SOURCE_ROOT; };
B2CD14621D45F18B008082E8 /* LFAVEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFAVEncoder.h; sourceTree = "<group>"; };
B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LFAVEncoder.mm; sourceTree = "<group>"; };
B2CD14641D45F18B008082E8 /* LICENSE.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.markdown; sourceTree = "<group>"; };
B2CD14651D45F18B008082E8 /* LFMP4Atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFMP4Atom.h; sourceTree = "<group>"; };
B2CD14661D45F18B008082E8 /* LFMP4Atom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFMP4Atom.m; sourceTree = "<group>"; };
B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LFNALUnit.cpp; sourceTree = "<group>"; };
B2CD14681D45F18B008082E8 /* LFNALUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFNALUnit.h; sourceTree = "<group>"; };
B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFVideoEncoder.h; sourceTree = "<group>"; };
B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFVideoEncoder.m; sourceTree = "<group>"; };
B2CD146B1D45F18B008082E8 /* LFH264VideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFH264VideoEncoder.h; sourceTree = "<group>"; };
B2CD146C1D45F18B008082E8 /* LFH264VideoEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LFH264VideoEncoder.mm; sourceTree = "<group>"; };
D0BB7E7CE5403C4911E026B9 /* Pods-LFLiveKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKit/Pods-LFLiveKit.debug.xcconfig"; sourceTree = "<group>"; };
@@ -1444,15 +1444,15 @@
B2CD14611D45F18B008082E8 /* H264 */ = {
isa = PBXGroup;
children = (
B221C2471D59D41A009615C3 /* LFAVEncoder.h */,
B221C2481D59D41A009615C3 /* LFAVEncoder.mm */,
B221C2491D59D41A009615C3 /* LFMP4Atom.h */,
B221C24A1D59D41A009615C3 /* LFMP4Atom.m */,
B221C24B1D59D41A009615C3 /* LFNALUnit.cpp */,
B221C24C1D59D41A009615C3 /* LFNALUnit.h */,
B221C24D1D59D41A009615C3 /* LFVideoEncoder.h */,
B221C24E1D59D41A009615C3 /* LFVideoEncoder.m */,
B2CD14621D45F18B008082E8 /* LFAVEncoder.h */,
B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */,
B2CD14641D45F18B008082E8 /* LICENSE.markdown */,
B2CD14651D45F18B008082E8 /* LFMP4Atom.h */,
B2CD14661D45F18B008082E8 /* LFMP4Atom.m */,
B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */,
B2CD14681D45F18B008082E8 /* LFNALUnit.h */,
B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */,
B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */,
);
path = H264;
sourceTree = "<group>";
@@ -1465,7 +1465,6 @@
buildActionMask = 2147483647;
files = (
84001FE51D0016380026C63F /* LFAudioFrame.h in Headers */,
B221C24F1D59D41A009615C3 /* LFAVEncoder.h in Headers */,
843724711D4F260A002B398B /* GPUImagePerlinNoiseFilter.h in Headers */,
843724F61D4F260A002B398B /* bytes.h in Headers */,
84001FED1D0016380026C63F /* LFVideoFrame.h in Headers */,
@@ -1500,6 +1499,8 @@
843724F21D4F260A002B398B /* GPUImageView.h in Headers */,
843724991D4F260A002B398B /* GPUImageSharpenFilter.h in Headers */,
84001FDD1D0016380026C63F /* LFLiveVideoConfiguration.h in Headers */,
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */,
849005B61D4B5C8400D2A3D5 /* error.h in Headers */,
843724FB1D4F260A002B398B /* handshake.h in Headers */,
843723F31D4F260A002B398B /* GPUImageFalseColorFilter.h in Headers */,
843723B71D4F260A002B398B /* GPUImageCannyEdgeDetectionFilter.h in Headers */,
@@ -1510,6 +1511,7 @@
843724AD1D4F260A002B398B /* GPUImageSolidColorGenerator.h in Headers */,
8437244D1D4F260A002B398B /* GPUImageMaskFilter.h in Headers */,
843723E91D4F260A002B398B /* GPUImageDivideBlendFilter.h in Headers */,
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */,
84001FE31D0016380026C63F /* LFLiveSession.h in Headers */,
843724411D4F260A002B398B /* GPUImageLookupFilter.h in Headers */,
843724E91D4F260A002B398B /* GPUImageFramework.h in Headers */,
@@ -1549,7 +1551,6 @@
843724251D4F260A002B398B /* GPUImageHSBFilter.h in Headers */,
843724891D4F260A002B398B /* GPUImageRGBDilationFilter.h in Headers */,
843724C31D4F260A002B398B /* GPUImageThresholdedNonMaximumSuppressionFilter.h in Headers */,
B221C2511D59D41A009615C3 /* LFMP4Atom.h in Headers */,
843723A71D4F260A002B398B /* GPUImageAmatorkaFilter.h in Headers */,
8437245F1D4F260A002B398B /* GPUImageMultiplyBlendFilter.h in Headers */,
84001FE91D0016380026C63F /* LFLiveDebug.h in Headers */,
@@ -1563,7 +1564,6 @@
843723F91D4F260A002B398B /* GPUImageFilterGroup.h in Headers */,
843723C31D4F260A002B398B /* GPUImageColorBurnBlendFilter.h in Headers */,
8437243B1D4F260A002B398B /* GPUImageLinearBurnBlendFilter.h in Headers */,
B221C2551D59D41A009615C3 /* LFVideoEncoder.h in Headers */,
843724011D4F260A002B398B /* GPUImageFramebufferCache.h in Headers */,
8437247B1D4F260A002B398B /* GPUImagePolarPixellateFilter.h in Headers */,
843724AB1D4F260A002B398B /* GPUImageSolarizeFilter.h in Headers */,
@@ -1579,7 +1579,6 @@
843723EB1D4F260A002B398B /* GPUImageEmbossFilter.h in Headers */,
843724EC1D4F260A002B398B /* GPUImageMovieWriter.h in Headers */,
843724451D4F260A002B398B /* GPUImageLuminanceRangeFilter.h in Headers */,
B221C2541D59D41A009615C3 /* LFNALUnit.h in Headers */,
843723D31D4F260A002B398B /* GPUImageColourFASTSamplingOperation.h in Headers */,
8437243F1D4F260A002B398B /* GPUImageLocalBinaryPatternFilter.h in Headers */,
843725021D4F260A002B398B /* rtmp.h in Headers */,
@@ -1633,12 +1632,22 @@
84001FE11D0016380026C63F /* LFGPUImageEmptyFilter.h in Headers */,
843724B51D4F260A002B398B /* GPUImageStretchDistortionFilter.h in Headers */,
84001FDA1D0016380026C63F /* LFVideoEncoding.h in Headers */,
84001FE51D0016380026C63F /* LFAudioFrame.h in Headers */,
84001FED1D0016380026C63F /* LFVideoFrame.h in Headers */,
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */,
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */,
849005BF1D4B5C8400D2A3D5 /* rtmp_sys.h in Headers */,
849005BE1D4B5C8400D2A3D5 /* rtmp.h in Headers */,
843724BF1D4F260A002B398B /* GPUImageThreeInputFilter.h in Headers */,
843724F71D4F260A002B398B /* dh.h in Headers */,
843725031D4F260A002B398B /* rtmp_sys.h in Headers */,
843724691D4F260A002B398B /* GPUImageOpeningFilter.h in Headers */,
843723C11D4F260A002B398B /* GPUImageColorBlendFilter.h in Headers */,
8437249F1D4F260A002B398B /* GPUImageSketchFilter.h in Headers */,
84001FE51D0016380026C63F /* LFAudioFrame.h in Headers */,
84001FED1D0016380026C63F /* LFVideoFrame.h in Headers */,
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */,
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */,
84001FD81D0016380026C63F /* LFHardwareVideoEncoder.h in Headers */,
843724A91D4F260A002B398B /* GPUImageSoftLightBlendFilter.h in Headers */,
843723A91D4F260A002B398B /* GPUImageAverageColor.h in Headers */,
@@ -1652,6 +1661,8 @@
843724611D4F260A002B398B /* GPUImageNobleCornerDetectionFilter.h in Headers */,
8437243D1D4F260A002B398B /* GPUImageLineGenerator.h in Headers */,
84001FD51D0016380026C63F /* LFAudioEncoding.h in Headers */,
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */,
849005B11D4B5C8400D2A3D5 /* amf.h in Headers */,
843723AB1D4F260A002B398B /* GPUImageAverageLuminanceThresholdFilter.h in Headers */,
843723F71D4F260A002B398B /* GPUImageFilter.h in Headers */,
8437240F1D4F260A002B398B /* GPUImageHalftoneFilter.h in Headers */,
@@ -1669,6 +1680,7 @@
843724551D4F260A002B398B /* GPUImageMosaicFilter.h in Headers */,
843723BD1D4F260A002B398B /* GPUImageChromaKeyFilter.h in Headers */,
843724171D4F260A002B398B /* GPUImageHighlightShadowFilter.h in Headers */,
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */,
84001F8E1D0015D10026C63F /* LFLiveKit.h in Headers */,
843724671D4F260A002B398B /* GPUImageOpacityFilter.h in Headers */,
8437247F1D4F260A002B398B /* GPUImagePosterizeFilter.h in Headers */,
@@ -1776,6 +1788,8 @@
84001FE21D0016380026C63F /* LFGPUImageEmptyFilter.m in Sources */,
843724C21D4F260A002B398B /* GPUImageThresholdEdgeDetectionFilter.m in Sources */,
84001FE41D0016380026C63F /* LFLiveSession.m in Sources */,
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */,
849005B81D4B5C8400D2A3D5 /* hashswf.c in Sources */,
843724BA1D4F260A002B398B /* GPUImageSwirlFilter.m in Sources */,
843723A41D4F260A002B398B /* GPUImageAddBlendFilter.m in Sources */,
843723B01D4F260A002B398B /* GPUImageBoxBlurFilter.m in Sources */,
@@ -1784,9 +1798,9 @@
843724101D4F260A002B398B /* GPUImageHalftoneFilter.m in Sources */,
843724301D4F260A002B398B /* GPUImageKuwaharaFilter.m in Sources */,
843724201D4F260A002B398B /* GPUImageHistogramFilter.m in Sources */,
B221C2531D59D41A009615C3 /* LFNALUnit.cpp in Sources */,
8437246E1D4F260A002B398B /* GPUImageOverlayBlendFilter.m in Sources */,
843723A81D4F260A002B398B /* GPUImageAmatorkaFilter.m in Sources */,
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */,
84001FE61D0016380026C63F /* LFAudioFrame.m in Sources */,
843724C41D4F260A002B398B /* GPUImageThresholdedNonMaximumSuppressionFilter.m in Sources */,
843724F91D4F260A002B398B /* error.c in Sources */,
@@ -1798,6 +1812,10 @@
84001FD41D0016380026C63F /* LFVideoCapture.m in Sources */,
843723B81D4F260A002B398B /* GPUImageCannyEdgeDetectionFilter.m in Sources */,
84001FE81D0016380026C63F /* LFFrame.m in Sources */,
<<<<<<< HEAD
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */,
=======
>>>>>>> rename h264 encode lib to avoid duplicate symbol error
843724CE1D4F260A002B398B /* GPUImageTransformFilter.m in Sources */,
843723E81D4F260A002B398B /* GPUImageDissolveBlendFilter.m in Sources */,
843723D81D4F260A002B398B /* GPUImageCropFilter.m in Sources */,
@@ -1806,6 +1824,7 @@
843723F21D4F260A002B398B /* GPUImageExposureFilter.m in Sources */,
8437244E1D4F260A002B398B /* GPUImageMaskFilter.m in Sources */,
843724841D4F260A002B398B /* GPUImageRawDataInput.m in Sources */,
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */,
B289F1DC1D3DE77F00D9C7A5 /* LFStreamingBuffer.m in Sources */,
843723F01D4F260A002B398B /* GPUImageExclusionBlendFilter.m in Sources */,
843724F31D4F260A002B398B /* GPUImageView.m in Sources */,
@@ -1846,19 +1865,20 @@
843724781D4F260A002B398B /* GPUImagePixellatePositionFilter.m in Sources */,
8437245A1D4F260A002B398B /* GPUImageMotionDetector.m in Sources */,
84001FD21D0016380026C63F /* LFAudioCapture.m in Sources */,
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */,
843724B81D4F260A002B398B /* GPUImageSubtractBlendFilter.m in Sources */,
843724741D4F260A002B398B /* GPUImagePinchDistortionFilter.m in Sources */,
843724D61D4F260A002B398B /* GPUImageTwoPassTextureSamplingFilter.m in Sources */,
843723DA1D4F260A002B398B /* GPUImageCrosshairGenerator.m in Sources */,
843724A01D4F260A002B398B /* GPUImageSketchFilter.m in Sources */,
843723A01D4F260A002B398B /* GPUImage3x3TextureSamplingFilter.m in Sources */,
B221C2561D59D41A009615C3 /* LFVideoEncoder.m in Sources */,
8437249A1D4F260A002B398B /* GPUImageSharpenFilter.m in Sources */,
843723C41D4F260A002B398B /* GPUImageColorBurnBlendFilter.m in Sources */,
843724121D4F260A002B398B /* GPUImageHardLightBlendFilter.m in Sources */,
843723D61D4F260A002B398B /* GPUImageContrastFilter.m in Sources */,
843724BC1D4F260A002B398B /* GPUImageTextureInput.m in Sources */,
843724521D4F260A002B398B /* GPUImageMissEtikateFilter.m in Sources */,
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */,
B2CD146F1D45F18B008082E8 /* LICENSE.markdown in Sources */,
B289F1DE1D3DE77F00D9C7A5 /* LFStreamRtmpSocket.m in Sources */,
843724CA1D4F260A002B398B /* GPUImageToneCurveFilter.m in Sources */,
@@ -1872,7 +1892,6 @@
8437245C1D4F260A002B398B /* GPUImageMovie.m in Sources */,
84001FD91D0016380026C63F /* LFHardwareVideoEncoder.m in Sources */,
843724A61D4F260A002B398B /* GPUImageSobelEdgeDetectionFilter.m in Sources */,
B221C2501D59D41A009615C3 /* LFAVEncoder.mm in Sources */,
843724281D4F260A002B398B /* GPUImageHueBlendFilter.m in Sources */,
843723B61D4F260A002B398B /* GPUImageBulgeDistortionFilter.m in Sources */,
8437243A1D4F260A002B398B /* GPUImageLightenBlendFilter.m in Sources */,
@@ -1885,7 +1904,6 @@
843724961D4F260A002B398B /* GPUImageScreenBlendFilter.m in Sources */,
843724541D4F260A002B398B /* GPUImageMonochromeFilter.m in Sources */,
843723B41D4F260A002B398B /* GPUImageBuffer.m in Sources */,
B221C2521D59D41A009615C3 /* LFMP4Atom.m in Sources */,
8437239B1D4F260A002B398B /* GLProgram.m in Sources */,
843724E81D4F260A002B398B /* GPUImageZoomBlurFilter.m in Sources */,
84001FEC1D0016380026C63F /* LFLiveStreamInfo.m in Sources */,
@@ -1968,12 +1986,14 @@
843723AC1D4F260A002B398B /* GPUImageAverageLuminanceThresholdFilter.m in Sources */,
843723FA1D4F260A002B398B /* GPUImageFilterGroup.m in Sources */,
84001FE01D0016380026C63F /* LFGPUImageBeautyFilter.m in Sources */,
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */,
843723FC1D4F260A002B398B /* GPUImageFilterPipeline.m in Sources */,
843724441D4F260A002B398B /* GPUImageLowPassFilter.m in Sources */,
843725011D4F260A002B398B /* rtmp.c in Sources */,
843724221D4F260A002B398B /* GPUImageHistogramGenerator.m in Sources */,
843724621D4F260A002B398B /* GPUImageNobleCornerDetectionFilter.m in Sources */,
843724341D4F260A002B398B /* GPUImageLanczosResamplingFilter.m in Sources */,
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2095,7 +2115,6 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = LFLiveKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
@@ -2106,21 +2125,14 @@
);
OTHER_CFLAGS = (
"$(inherited)",
"-isystem",
"\"${PODS_ROOT}/Headers/Public\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/LMGPUImage\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/pili-librtmp\"",
"-fembed-bitcode",
);
OTHER_LDFLAGS = (
"-ObjC",
"-framework",
"\"AVFoundation\"",
"-framework",
"\"CoreMedia\"",
"-framework",
"\"OpenGLES\"",
"-framework",
"\"QuartzCore\"",
"-framework",
"\"UIKit\"",
);
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit.LFLiveKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -2137,7 +2149,6 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = LFLiveKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
@@ -2148,21 +2159,14 @@
);
OTHER_CFLAGS = (
"$(inherited)",
"-isystem",
"\"${PODS_ROOT}/Headers/Public\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/LMGPUImage\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/pili-librtmp\"",
"-fembed-bitcode",
);
OTHER_LDFLAGS = (
"-ObjC",
"-framework",
"\"AVFoundation\"",
"-framework",
"\"CoreMedia\"",
"-framework",
"\"OpenGLES\"",
"-framework",
"\"QuartzCore\"",
"-framework",
"\"UIKit\"",
);
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit.LFLiveKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
-39
View File
@@ -15,26 +15,6 @@
#import "LFLiveVideoConfiguration.h"
#import "LFLiveDebug.h"
typedef NS_ENUM(NSInteger,LFLiveCaptureType) {
LFLiveCaptureAudio, //< capture only audio
LFLiveCaptureVideo, //< capture onlt video
LFLiveInputAudio, //< only audio (External input audio)
LFLiveInputVideo, //< only video (External input video)
};
///< 用来控制采集类型(可以内部采集也可以外部传入等各种组合,支持单音频与单视频,外部输入适用于录屏,无人机等外设介入)
typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
LFLiveCaptureMaskAudio = (1 << LFLiveCaptureAudio), ///< only inner capture audio (no video)
LFLiveCaptureMaskVideo = (1 << LFLiveCaptureVideo), ///< only inner capture video (no audio)
LFLiveInputMaskAudio = (1 << LFLiveInputAudio), ///< only outer input audio (no video)
LFLiveInputMaskVideo = (1 << LFLiveInputVideo), ///< only outer input video (no audio)
LFLiveCaptureMaskAll = (LFLiveCaptureMaskAudio | LFLiveCaptureMaskVideo), ///< inner capture audio and video
LFLiveInputMaskAll = (LFLiveInputMaskAudio | LFLiveInputMaskVideo), ///< outer input audio and video(method see pushVideo and pushAudio)
LFLiveCaptureMaskAudioInputVideo = (LFLiveCaptureMaskAudio | LFLiveInputMaskVideo), ///< inner capture audio and outer input video(method pushVideo and setRunning)
LFLiveCaptureMaskVideoInputAudio = (LFLiveCaptureMaskVideo | LFLiveInputMaskAudio), ///< inner capture video and outer input audio(method pushAudio and setRunning)
LFLiveCaptureDefaultMask = LFLiveCaptureMaskAll ///< default is inner capture audio and video
};
@class LFLiveSession;
@protocol LFLiveSessionDelegate <NSObject>
@@ -98,9 +78,6 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
/** The status of the stream .*/
@property (nonatomic, assign, readonly) LFLiveState state;
/** The captureType control inner or outer audio and video .*/
@property (nonatomic, assign, readonly) LFLiveCaptureTypeMask captureType;
/** The showDebugInfo control streamInfo and uploadInfo(1s) *.*/
@property (nonatomic, assign) BOOL showDebugInfo;
@@ -110,11 +87,6 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
/** The reconnectCount control reconnect count (重连次数) *.*/
@property (nonatomic, assign) NSUInteger reconnectCount;
/*** The warterMarkView control whether the watermark is displayed or not ,if set ni,will remove watermark,otherwise add.
set alpha represent mix.Position relative to outVideoSize.
*.*/
@property (nonatomic, strong) UIView *warterMarkView;
#pragma mark - Initializer
///=============================================================================
/// @name Initializer
@@ -128,23 +100,12 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
*/
- (nullable instancetype)initWithAudioConfiguration:(nullable LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(nullable LFLiveVideoConfiguration *)videoConfiguration NS_DESIGNATED_INITIALIZER;
/**
The designated initializer. Multiple instances with the same configuration will make the
capture unstable.
*/
- (nullable instancetype)initWithAudioConfiguration:(nullable LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(nullable LFLiveVideoConfiguration *)videoConfiguration captureType:(LFLiveCaptureTypeMask)captureType NS_DESIGNATED_INITIALIZER;
/** The start stream .*/
- (void)startLive:(nonnull LFLiveStreamInfo *)streamInfo;
/** The stop stream .*/
- (void)stopLive;
/** support outer input yuv or rgb video(set LFLiveCaptureTypeMask) .*/
- (void)pushVideo:(CVPixelBufferRef)pixelBuffer;
/** support outer input pcm audio(set LFLiveCaptureTypeMask) .*/
- (void)pushAudio:(AudioBufferList)audioBufferList;
@end
+30 -68
View File
@@ -17,12 +17,15 @@
#import "LFGPUImageBeautyFilter.h"
#import "LFH264VideoEncoder.h"
#define LFLiveReportKey @"com.youku.liveSessionReport"
@interface LFLiveSession ()<LFAudioCaptureDelegate, LFVideoCaptureDelegate, LFAudioEncodingDelegate, LFVideoEncodingDelegate, LFStreamSocketDelegate>
/// 音频配置
{
dispatch_semaphore_t _lock;
}
///音频配置
@property (nonatomic, strong) LFLiveAudioConfiguration *audioConfiguration;
/// 视频配置
///视频配置
@property (nonatomic, strong) LFLiveVideoConfiguration *videoConfiguration;
/// 声音采集
@property (nonatomic, strong) LFAudioCapture *audioCaptureSource;
@@ -35,21 +38,17 @@
/// 上传
@property (nonatomic, strong) id<LFStreamSocket> socket;
#pragma mark -- 内部标识
/// 调试信息
/// 上报
@property (nonatomic, copy) dispatch_block_t reportBlock;
/// debugInfo
@property (nonatomic, strong) LFLiveDebug *debugInfo;
/// 流信息
/// streamInfo
@property (nonatomic, strong) LFLiveStreamInfo *streamInfo;
/// 是否开始上传
/// uploading
@property (nonatomic, assign) BOOL uploading;
/// 当前状态
/// state
@property (nonatomic, assign, readwrite) LFLiveState state;
/// 当前直播type
@property (nonatomic, assign, readwrite) LFLiveCaptureTypeMask captureType;
/// 时间戳锁
@property (nonatomic, strong) dispatch_semaphore_t lock;
@end
@@ -69,25 +68,20 @@
#pragma mark -- LifeCycle
- (instancetype)initWithAudioConfiguration:(LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(LFLiveVideoConfiguration *)videoConfiguration {
return [self initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration captureType:LFLiveCaptureDefaultMask];
}
- (nullable instancetype)initWithAudioConfiguration:(nullable LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(nullable LFLiveVideoConfiguration *)videoConfiguration captureType:(LFLiveCaptureTypeMask)captureType{
if((captureType & LFLiveCaptureMaskAudio || captureType & LFLiveInputMaskAudio) && !audioConfiguration) @throw [NSException exceptionWithName:@"LFLiveSession init error" reason:@"audioConfiguration is nil " userInfo:nil];
if((captureType & LFLiveCaptureMaskVideo || captureType & LFLiveInputMaskVideo) && !videoConfiguration) @throw [NSException exceptionWithName:@"LFLiveSession init error" reason:@"videoConfiguration is nil " userInfo:nil];
if (!audioConfiguration || !videoConfiguration) @throw [NSException exceptionWithName:@"LFLiveSession init error" reason:@"audioConfiguration or videoConfiguration is nil " userInfo:nil];
if (self = [super init]) {
_audioConfiguration = audioConfiguration;
_videoConfiguration = videoConfiguration;
_lock = dispatch_semaphore_create(1);
_adaptiveBitrate = NO;
_isFirstFrame = YES;
_captureType = captureType;
}
return self;
}
- (void)dealloc {
self.videoCaptureSource.running = NO;
self.audioCaptureSource.running = NO;
self.videoCaptureSource.running = NO;
}
#pragma mark -- CustomMethod
@@ -96,7 +90,6 @@
_streamInfo = streamInfo;
_streamInfo.videoConfiguration = _videoConfiguration;
_streamInfo.audioConfiguration = _audioConfiguration;
_streamInfo.needDropFrame = (self.captureType & LFLiveCaptureMaskVideo || self.captureType & LFLiveInputMaskVideo) ? YES : NO;//< 有视频执行丢帧算法
[self.socket start];
}
@@ -106,24 +99,12 @@
self.socket = nil;
}
- (void)pushVideo:(CVPixelBufferRef)pixelBuffer{
if(self.captureType & LFLiveInputMaskVideo){
if (self.uploading) [self.videoEncoder encodeVideoData:pixelBuffer timeStamp:self.currentTimestamp];
}
}
- (void)pushAudio:(AudioBufferList)audioBufferList{
if(self.captureType & LFLiveInputMaskAudio){
if (self.uploading) [self.audioEncoder encodeAudioData:audioBufferList timeStamp:self.currentTimestamp];
}
}
#pragma mark -- CaptureDelegate
- (void)captureOutput:(nullable LFAudioCapture *)capture audioBuffer:(AudioBufferList)inBufferList {
if (self.uploading) [self.audioEncoder encodeAudioData:inBufferList timeStamp:self.currentTimestamp];
}
- (void)captureOutput:(nullable LFVideoCapture *)capture pixelBuffer:(nullable CVPixelBufferRef)pixelBuffer {
- (void)captureOutput:(nullable LFVideoCapture *)capture pixelBuffer:(nullable CVImageBufferRef)pixelBuffer {
if (self.uploading) [self.videoEncoder encodeVideoData:pixelBuffer timeStamp:self.currentTimestamp];
}
@@ -175,18 +156,18 @@
}
- (void)socketBufferStatus:(nullable id<LFStreamSocket>)socket status:(LFLiveBuffferState)status {
if((self.captureType & LFLiveCaptureMaskVideo || self.captureType & LFLiveInputMaskVideo) && self.adaptiveBitrate){
NSUInteger videoBitRate = [self.videoEncoder videoBitRate];
if (self.adaptiveBitrate) {
NSUInteger videoBitRate = [_videoEncoder videoBitRate];
if (status == LFLiveBuffferDecline) {
if (videoBitRate < _videoConfiguration.videoMaxBitRate) {
videoBitRate = videoBitRate + 50 * 1000;
[self.videoEncoder setVideoBitRate:videoBitRate];
[_videoEncoder setVideoBitRate:videoBitRate];
NSLog(@"Increase bitrate %@", @(videoBitRate));
}
} else {
if (videoBitRate > self.videoConfiguration.videoMinBitRate) {
if (videoBitRate > _videoConfiguration.videoMinBitRate) {
videoBitRate = videoBitRate - 100 * 1000;
[self.videoEncoder setVideoBitRate:videoBitRate];
[_videoEncoder setVideoBitRate:videoBitRate];
NSLog(@"Decline bitrate %@", @(videoBitRate));
}
}
@@ -293,30 +274,18 @@
return self.audioCaptureSource.muted;
}
- (void)setWarterMarkView:(UIView *)warterMarkView{
[self.videoCaptureSource setWarterMarkView:warterMarkView];
}
- (UIView*)warterMarkView{
return self.videoCaptureSource.warterMarkView;
}
- (LFAudioCapture *)audioCaptureSource {
if (!_audioCaptureSource) {
if(self.captureType & LFLiveCaptureMaskAudio){
_audioCaptureSource = [[LFAudioCapture alloc] initWithAudioConfiguration:_audioConfiguration];
_audioCaptureSource.delegate = self;
}
_audioCaptureSource = [[LFAudioCapture alloc] initWithAudioConfiguration:_audioConfiguration];
_audioCaptureSource.delegate = self;
}
return _audioCaptureSource;
}
- (LFVideoCapture *)videoCaptureSource {
if (!_videoCaptureSource) {
if(self.captureType & LFLiveCaptureMaskVideo){
_videoCaptureSource = [[LFVideoCapture alloc] initWithVideoConfiguration:_videoConfiguration];
_videoCaptureSource.delegate = self;
}
_videoCaptureSource = [[LFVideoCapture alloc] initWithVideoConfiguration:_videoConfiguration];
_videoCaptureSource.delegate = self;
}
return _videoCaptureSource;
}
@@ -331,9 +300,9 @@
- (id<LFVideoEncoding>)videoEncoder {
if (!_videoEncoder) {
if([[UIDevice currentDevice].systemVersion floatValue] < 8.0){
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
_videoEncoder = [[LFH264VideoEncoder alloc] initWithVideoStreamConfiguration:_videoConfiguration];
}else{
} else {
_videoEncoder = [[LFHardwareVideoEncoder alloc] initWithVideoStreamConfiguration:_videoConfiguration];
}
[_videoEncoder setDelegate:self];
@@ -343,7 +312,7 @@
- (id<LFStreamSocket>)socket {
if (!_socket) {
_socket = [[LFStreamRTMPSocket alloc] initWithStream:self.streamInfo reconnectInterval:self.reconnectInterval reconnectCount:self.reconnectCount];
_socket = [[LFStreamRTMPSocket alloc] initWithStream:self.streamInfo videoSize:self.videoConfiguration.videoSize reconnectInterval:self.reconnectInterval reconnectCount:self.reconnectCount];
[_socket setDelegate:self];
}
return _socket;
@@ -356,15 +325,8 @@
return _streamInfo;
}
- (dispatch_semaphore_t)lock{
if(!_lock){
_lock = dispatch_semaphore_create(1);
}
return _lock;
}
- (uint64_t)currentTimestamp {
dispatch_semaphore_wait(self.lock, DISPATCH_TIME_FOREVER);
dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER);
uint64_t currentts = 0;
if (_isFirstFrame) {
_timestamp = NOW;
@@ -373,7 +335,7 @@
} else {
currentts = NOW - _timestamp;
}
dispatch_semaphore_signal(self.lock);
dispatch_semaphore_signal(_lock);
return currentts;
}
+6 -7
View File
@@ -86,10 +86,10 @@
GLubyte *imageData = (GLubyte *) calloc(1, (int)layerPixelSize.width * (int)layerPixelSize.height * 4);
CGColorSpaceRef genericRGBColorspace = CGColorSpaceCreateDeviceRGB();
CGColorSpaceRef genericRGBColorspace = CGColorSpaceCreateDeviceRGB();
CGContextRef imageContext = CGBitmapContextCreate(imageData, (int)layerPixelSize.width, (int)layerPixelSize.height, 8, (int)layerPixelSize.width * 4, genericRGBColorspace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
// CGContextRotateCTM(imageContext, M_PI_2);
CGContextTranslateCTM(imageContext, 0.0f, layerPixelSize.height);
// CGContextRotateCTM(imageContext, M_PI_2);
CGContextTranslateCTM(imageContext, 0.0f, layerPixelSize.height);
CGContextScaleCTM(imageContext, layer.contentsScale, -layer.contentsScale);
// CGContextSetBlendMode(imageContext, kCGBlendModeCopy); // From Technical Q&A QA1708: http://developer.apple.com/library/ios/#qa/qa1708/_index.html
@@ -100,13 +100,13 @@
// TODO: This may not work
outputFramebuffer = [[GPUImageContext sharedFramebufferCache] fetchFramebufferForSize:layerPixelSize textureOptions:self.outputTextureOptions onlyTexture:YES];
[outputFramebuffer disableReferenceCounting]; // Add this line, because GPUImageTwoInputFilter.m frametime updatedMovieFrameOppositeStillImage is YES, but the secondbuffer not lock
glBindTexture(GL_TEXTURE_2D, [outputFramebuffer texture]);
// no need to use self.outputTextureOptions here, we always need these texture options
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (int)layerPixelSize.width, (int)layerPixelSize.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, imageData);
free(imageData);
for (id<GPUImageInput> currentTarget in targets)
{
if (currentTarget != self.targetToIgnoreForUpdates)
@@ -115,10 +115,9 @@
NSInteger textureIndexOfTarget = [[targetTextureIndices objectAtIndex:indexOfObject] integerValue];
[currentTarget setInputSize:layerPixelSize atIndex:textureIndexOfTarget];
[currentTarget setInputFramebuffer:outputFramebuffer atIndex:textureIndexOfTarget]; // add this line, because the outputFramebuffer is update above
[currentTarget newFrameReadyAtTime:frameTime atIndex:textureIndexOfTarget];
}
}
}
}
@end
+1 -4
View File
@@ -13,7 +13,7 @@
@class LFVideoCapture;
/** LFVideoCapture callback videoData */
@protocol LFVideoCaptureDelegate <NSObject>
- (void)captureOutput:(nullable LFVideoCapture *)capture pixelBuffer:(nullable CVPixelBufferRef)pixelBuffer;
- (void)captureOutput:(nullable LFVideoCapture *)capture pixelBuffer:(nullable CVImageBufferRef)pixelBuffer;
@end
@interface LFVideoCapture : NSObject
@@ -56,9 +56,6 @@
/** The videoFrameRate control videoCapture output data count */
@property (nonatomic, assign) NSInteger videoFrameRate;
/*** The warterMarkView control whether the watermark is displayed or not ,if set ni,will remove watermark,otherwise add *.*/
@property (nonatomic, strong) UIView *warterMarkView;
#pragma mark - Initializer
///=============================================================================
/// @name Initializer
+145 -162
View File
@@ -13,17 +13,13 @@
@interface LFVideoCapture ()
@property (nonatomic, strong) GPUImageVideoCamera *videoCamera;
@property (nonatomic, weak) LFGPUImageBeautyFilter *beautyFilter;
@property (nonatomic, strong) GPUImageOutput<GPUImageInput> *filter;
@property (nonatomic, strong) GPUImageCropFilter *cropfilter;
@property (nonatomic, strong) GPUImageOutput<GPUImageInput> *output;
@property (nonatomic, strong) GPUImageView *gpuImageView;
@property (nonatomic, strong) LFLiveVideoConfiguration *configuration;
@property (nonatomic, strong) GPUImageAlphaBlendFilter *blendFilter;
@property (nonatomic, strong) GPUImageUIElement *uiElementInput;
@property (nonatomic, strong) UIView *waterMarkContentView;
@property(nonatomic, strong) GPUImageVideoCamera *videoCamera;
@property(nonatomic, weak) LFGPUImageBeautyFilter *beautyFilter;
@property(nonatomic, strong) GPUImageOutput<GPUImageInput> *filter;
@property(nonatomic, strong) GPUImageOutput<GPUImageInput> *output;
@property(nonatomic, strong) GPUImageCropFilter *cropfilter;
@property(nonatomic, strong) GPUImageView *gpuImageView;
@property(nonatomic, strong) LFLiveVideoConfiguration *configuration;
@end
@@ -37,32 +33,14 @@
- (instancetype)initWithVideoConfiguration:(LFLiveVideoConfiguration *)configuration {
if (self = [super init]) {
_configuration = configuration;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
self.beautyFace = YES;
self.beautyLevel = 0.5;
self.brightLevel = 0.5;
self.zoomScale = 1.0;
self.mirror = YES;
}
return self;
}
- (void)dealloc {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.videoCamera stopCameraCapture];
}
#pragma mark -- Setter Getter
- (GPUImageVideoCamera *)videoCamera{
if(!_videoCamera){
if([self pixelBufferImageSize].width < configuration.videoSize.width || [self pixelBufferImageSize].height < configuration.videoSize.height){
@throw [NSException exceptionWithName:@"当前videoSize大小出错" reason:@"LFLiveVideoConfiguration videoSize error" userInfo:nil];
return nil;
}
_videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:_configuration.avSessionPreset cameraPosition:AVCaptureDevicePositionFront];
UIInterfaceOrientation statusBar = [[UIApplication sharedApplication] statusBarOrientation];
if (self.configuration.landscape) {
if (configuration.landscape) {
if (statusBar != UIInterfaceOrientationLandscapeLeft && statusBar != UIInterfaceOrientationLandscapeRight) {
@throw [NSException exceptionWithName:@"当前设置方向出错" reason:@"LFLiveVideoConfiguration landscape error" userInfo:nil];
_videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
@@ -77,69 +55,92 @@
_videoCamera.outputImageOrientation = statusBar;
}
}
_videoCamera.horizontallyMirrorFrontFacingCamera = YES;
_videoCamera.horizontallyMirrorFrontFacingCamera = NO;
_videoCamera.horizontallyMirrorRearFacingCamera = NO;
_videoCamera.frameRate = (int32_t)_configuration.videoFrameRate;
_gpuImageView = [[GPUImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[_gpuImageView setFillMode:kGPUImageFillModePreserveAspectRatioAndFill];
[_gpuImageView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[_gpuImageView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
self.beautyFace = YES;
self.beautyLevel = 0.5;
self.brightLevel = 0.5;
self.zoomScale = 1.0;
}
return _videoCamera;
return self;
}
- (void)dealloc {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_videoCamera stopCameraCapture];
}
#pragma mark -- Setter Getter
- (void)setRunning:(BOOL)running {
if (_running == running) return;
_running = running;
if (!_running) {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[self.videoCamera stopCameraCapture];
[_videoCamera stopCameraCapture];
} else {
[UIApplication sharedApplication].idleTimerDisabled = YES;
[self reloadFilter];
[self.videoCamera startCameraCapture];
[_videoCamera startCameraCapture];
}
}
- (void)setPreView:(UIView *)preView {
if (self.gpuImageView.superview) [self.gpuImageView removeFromSuperview];
[preView insertSubview:self.gpuImageView atIndex:0];
self.gpuImageView.frame = CGRectMake(0, 0, preView.frame.size.width, preView.frame.size.height);
if (_gpuImageView.superview) [_gpuImageView removeFromSuperview];
[preView insertSubview:_gpuImageView atIndex:0];
}
- (UIView *)preView {
return self.gpuImageView.superview;
return _gpuImageView.superview;
}
- (void)setCaptureDevicePosition:(AVCaptureDevicePosition)captureDevicePosition {
[self.videoCamera rotateCamera];
self.videoCamera.frameRate = (int32_t)_configuration.videoFrameRate;
[_videoCamera rotateCamera];
_videoCamera.frameRate = (int32_t)_configuration.videoFrameRate;
if (captureDevicePosition == AVCaptureDevicePositionFront) {
[_gpuImageView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
} else {
[_gpuImageView setInputRotation:kGPUImageNoRotation atIndex:0];
}
}
- (AVCaptureDevicePosition)captureDevicePosition {
return [self.videoCamera cameraPosition];
return [_videoCamera cameraPosition];
}
- (void)setVideoFrameRate:(NSInteger)videoFrameRate {
if (videoFrameRate <= 0) return;
if (videoFrameRate == self.videoCamera.frameRate) return;
self.videoCamera.frameRate = (uint32_t)videoFrameRate;
if (videoFrameRate == _videoCamera.frameRate) return;
_videoCamera.frameRate = (uint32_t)videoFrameRate;
}
- (NSInteger)videoFrameRate {
return self.videoCamera.frameRate;
return _videoCamera.frameRate;
}
- (void)setTorch:(BOOL)torch {
BOOL ret;
if (!self.videoCamera.captureSession) return;
AVCaptureSession *session = (AVCaptureSession *)self.videoCamera.captureSession;
if (!_videoCamera.captureSession) return;
AVCaptureSession *session = (AVCaptureSession *)_videoCamera.captureSession;
[session beginConfiguration];
if (self.videoCamera.inputCamera) {
if (self.videoCamera.inputCamera.torchAvailable) {
if (_videoCamera.inputCamera) {
if (_videoCamera.inputCamera.torchAvailable) {
NSError *err = nil;
if ([self.videoCamera.inputCamera lockForConfiguration:&err]) {
[self.videoCamera.inputCamera setTorchMode:(torch ? AVCaptureTorchModeOn : AVCaptureTorchModeOff) ];
[self.videoCamera.inputCamera unlockForConfiguration];
ret = (self.videoCamera.inputCamera.torchMode == AVCaptureTorchModeOn);
if ([_videoCamera.inputCamera lockForConfiguration:&err]) {
[_videoCamera.inputCamera setTorchMode:(torch ? AVCaptureTorchModeOn : AVCaptureTorchModeOff) ];
[_videoCamera.inputCamera unlockForConfiguration];
ret = (_videoCamera.inputCamera.torchMode == AVCaptureTorchModeOn);
} else {
NSLog(@"Error while locking device for torch: %@", err);
ret = false;
@@ -153,23 +154,22 @@
}
- (BOOL)torch {
return self.videoCamera.inputCamera.torchMode;
return _videoCamera.inputCamera.torchMode;
}
- (void)setMirror:(BOOL)mirror {
_mirror = mirror;
self.videoCamera.horizontallyMirrorFrontFacingCamera = mirror;
_videoCamera.horizontallyMirrorFrontFacingCamera = mirror;
_videoCamera.horizontallyMirrorRearFacingCamera = mirror;
}
- (void)setBeautyFace:(BOOL)beautyFace{
_beautyFace = beautyFace;
[self reloadFilter];
- (BOOL)mirror {
return _videoCamera.horizontallyMirrorFrontFacingCamera;
}
- (void)setBeautyLevel:(CGFloat)beautyLevel {
_beautyLevel = beautyLevel;
if (self.beautyFilter) {
[self.beautyFilter setBeautyLevel:_beautyLevel];
if (_beautyFilter) {
[_beautyFilter setBeautyLevel:_beautyLevel];
}
}
@@ -179,8 +179,8 @@
- (void)setBrightLevel:(CGFloat)brightLevel {
_brightLevel = brightLevel;
if (self.beautyFilter) {
[self.beautyFilter setBrightLevel:brightLevel];
if (_beautyFilter) {
[_beautyFilter setBrightLevel:brightLevel];
}
}
@@ -203,49 +203,54 @@
return _zoomScale;
}
- (void)setWarterMarkView:(UIView *)warterMarkView{
if(_warterMarkView && _warterMarkView.superview){
[_warterMarkView removeFromSuperview];
_warterMarkView = nil;
}
_warterMarkView = warterMarkView;
self.blendFilter.mix = warterMarkView.alpha;
[self.waterMarkContentView addSubview:_warterMarkView];
[self reloadFilter];
}
- (void)setBeautyFace:(BOOL)beautyFace {
- (GPUImageUIElement *)uiElementInput{
if(!_uiElementInput){
_uiElementInput = [[GPUImageUIElement alloc] initWithView:self.waterMarkContentView];
}
return _uiElementInput;
}
_beautyFace = beautyFace;
[_filter removeAllTargets];
[_cropfilter removeAllTargets];
[_videoCamera removeAllTargets];
- (GPUImageAlphaBlendFilter *)blendFilter{
if(!_blendFilter){
_blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
_blendFilter.mix = 1.0;
[_blendFilter disableSecondFrameCheck];
if (_beautyFace) {
_output = [[LFGPUImageEmptyFilter alloc] init];
_filter = [[LFGPUImageBeautyFilter alloc] init];
_beautyFilter = _filter;
__weak typeof(self) _self = self;
[_output setFrameProcessingCompletionBlock:^(GPUImageOutput *output, CMTime time) {
[_self processVideo:output];
}];
} else {
_filter = [[LFGPUImageEmptyFilter alloc] init];
_beautyFilter = nil;
__weak typeof(self) _self = self;
[_filter setFrameProcessingCompletionBlock:^(GPUImageOutput *output, CMTime time) {
[_self processVideo:output];
}];
}
return _blendFilter;
}
- (UIView *)waterMarkContentView{
if(!_waterMarkContentView){
_waterMarkContentView = [UIView new];
_waterMarkContentView.frame = CGRectMake(0, 0, self.configuration.videoSize.width, self.configuration.videoSize.height);
_waterMarkContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
CGSize imageSize = [self pixelBufferImageSize];
CGFloat cropLeft = (imageSize.width - self.configuration.videoSize.width)/2.0/imageSize.width;
CGFloat cropTop = (imageSize.height - self.configuration.videoSize.height)/2.0/imageSize.height;
if(cropLeft == 0 && cropTop == 0){
[_videoCamera addTarget:_filter];
}else{
_cropfilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(cropLeft, cropTop, 1 - cropLeft*2, 1 - cropTop*2)];
[_videoCamera addTarget:_cropfilter];
[_cropfilter addTarget:_filter];
}
if (_beautyFace) {
[_filter addTarget:_output];
[_output addTarget:_gpuImageView];
} else {
[_filter addTarget:_gpuImageView];
}
return _waterMarkContentView;
}
- (GPUImageView *)gpuImageView{
if(!_gpuImageView){
_gpuImageView = [[GPUImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[_gpuImageView setFillMode:kGPUImageFillModePreserveAspectRatioAndFill];
[_gpuImageView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
if (_videoCamera.cameraPosition == AVCaptureDevicePositionFront) {
[_gpuImageView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
} else {
[_gpuImageView setInputRotation:kGPUImageNoRotation atIndex:0];
}
return _gpuImageView;
}
#pragma mark -- Custom Method
@@ -254,85 +259,33 @@
@autoreleasepool {
GPUImageFramebuffer *imageFramebuffer = output.framebufferForOutput;
CVPixelBufferRef pixelBuffer = [imageFramebuffer pixelBuffer];
if (pixelBuffer && _self.delegate && [_self.delegate respondsToSelector:@selector(captureOutput:pixelBuffer:)]) {
[_self.delegate captureOutput:_self pixelBuffer:pixelBuffer];
}
}
}
- (void)reloadFilter{
[self.filter removeAllTargets];
[self.blendFilter removeAllTargets];
[self.uiElementInput removeAllTargets];
[self.videoCamera removeAllTargets];
[self.output removeAllTargets];
[self.cropfilter removeAllTargets];
if (self.beautyFace) {
self.output = [[LFGPUImageEmptyFilter alloc] init];
self.filter = [[LFGPUImageBeautyFilter alloc] init];
self.beautyFilter = self.filter;
} else {
self.output = [[LFGPUImageEmptyFilter alloc] init];
self.filter = [[LFGPUImageEmptyFilter alloc] init];
self.beautyFilter = nil;
}
//< 480*640 比例为4:3 强制转换为16:9
if([self.configuration.avSessionPreset isEqualToString:AVCaptureSessionPreset640x480]){
CGRect cropRect = self.configuration.landscape ? CGRectMake(0, 0.125, 1, 0.75) : CGRectMake(0.125, 0, 0.75, 1);
self.cropfilter = [[GPUImageCropFilter alloc] initWithCropRegion:cropRect];
[self.videoCamera addTarget:self.cropfilter];
[self.cropfilter addTarget:self.filter];
}else{
[self.videoCamera addTarget:self.filter];
}
//< 添加水印
if(self.warterMarkView){
[self.filter addTarget:self.blendFilter];
[self.uiElementInput addTarget:self.blendFilter];
[self.blendFilter addTarget:self.gpuImageView];
[self.filter addTarget:self.output];
[self.uiElementInput update];
}else{
[self.filter addTarget:self.output];
[self.output addTarget:self.gpuImageView];
}
[self.filter forceProcessingAtSize:self.configuration.videoSize];
[self.output forceProcessingAtSize:self.configuration.videoSize];
[self.blendFilter forceProcessingAtSize:self.configuration.videoSize];
[self.uiElementInput forceProcessingAtSize:self.configuration.videoSize];
//< 输出数据
__weak typeof(self) _self = self;
[self.output setFrameProcessingCompletionBlock:^(GPUImageOutput *output, CMTime time) {
[_self processVideo:output];
}];
}
#pragma mark Notification
- (void)willEnterBackground:(NSNotification *)notification {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[self.videoCamera pauseCameraCapture];
[_videoCamera pauseCameraCapture];
runSynchronouslyOnVideoProcessingQueue(^{
glFinish();
});
}
- (void)willEnterForeground:(NSNotification *)notification {
[self.videoCamera resumeCameraCapture];
[_videoCamera resumeCameraCapture];
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
- (void)statusBarChanged:(NSNotification *)notification {
NSLog(@"UIApplicationWillChangeStatusBarOrientationNotification. UserInfo: %@", notification.userInfo);
UIInterfaceOrientation statusBar = [[UIApplication sharedApplication] statusBarOrientation];
if (self.configuration.landscape) {
if (_configuration.landscape) {
if (statusBar == UIInterfaceOrientationLandscapeLeft) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
} else if (statusBar == UIInterfaceOrientationLandscapeRight) {
@@ -347,4 +300,34 @@
}
}
#pragma mark --
- (CGSize)pixelBufferImageSize{
CGSize videoSize = CGSizeZero;
switch (self.configuration.sessionPreset) {
case LFCaptureSessionPreset360x640:
{
videoSize = CGSizeMake(480, 640);
}
break;
case LFCaptureSessionPreset540x960:
{
videoSize = CGSizeMake(540, 960);
}
break;
case LFCaptureSessionPreset720x1280:
{
videoSize = CGSizeMake(720, 1280);
}
break;
default:
break;
}
if(self.configuration.landscape){
return CGSizeMake(videoSize.height, videoSize.width);
}
return videoSize;
}
@end
+2 -2
View File
@@ -66,7 +66,7 @@
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(_configuration.videoBitRate));
NSArray *limit = @[@(_configuration.videoBitRate * 1.5/8), @(1)];
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_DataRateLimits, (__bridge CFArrayRef)limit);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_RealTime, kCFBooleanFalse);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_ProfileLevel, kVTProfileLevel_H264_Main_AutoLevel);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AllowFrameReordering, kCFBooleanTrue);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_H264EntropyMode, kVTH264EntropyMode_CABAC);
@@ -98,7 +98,7 @@
}
#pragma mark -- LFVideoEncoder
- (void)encodeVideoData:(CVPixelBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp {
- (void)encodeVideoData:(CVImageBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp {
if (_isBackGround) return;
frameCount++;
+1 -1
View File
@@ -20,7 +20,7 @@
/// 编码器抽象的接口
@protocol LFVideoEncoding <NSObject>
@required
- (void)encodeVideoData:(nullable CVPixelBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp;
- (void)encodeVideoData:(nullable CVImageBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp;
- (void)stopEncoder;
@optional
@property (nonatomic, assign) NSInteger videoBitRate;
@@ -57,12 +57,9 @@ typedef NS_ENUM (NSUInteger, LFLiveVideoQuality){
///=============================================================================
/// @name Attribute
///=============================================================================
/// 视频的分辨率,宽高务必设定为 2 的倍数,否则解码播放时可能出现绿边(这个videoSizeRespectingAspectRatio设置为YES则可能会改变)
/// 视频的分辨率,宽高务必设定为 2 的倍数,否则解码播放时可能出现绿边
@property (nonatomic, assign) CGSize videoSize;
/// 输出图像是否等比例,默认为NO
@property (nonatomic, assign) BOOL videoSizeRespectingAspectRatio;
/// 视频输出方向
@property (nonatomic, assign) BOOL landscape;
@@ -9,11 +9,9 @@
#import "LFLiveVideoConfiguration.h"
#import <AVFoundation/AVFoundation.h>
@implementation LFLiveVideoConfiguration
#pragma mark -- LifeCycle
+ (instancetype)defaultConfiguration {
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration defaultConfigurationForQuality:LFLiveVideoQuality_Default];
return configuration;
@@ -27,7 +25,8 @@
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality landscape:(BOOL)landscape {
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration new];
switch (videoQuality) {
case LFLiveVideoQuality_Low1:{
case LFLiveVideoQuality_Low1:
{
configuration.sessionPreset = LFCaptureSessionPreset360x640;
configuration.videoFrameRate = 15;
configuration.videoMaxFrameRate = 15;
@@ -37,8 +36,9 @@
configuration.videoMinBitRate = 400 * 1000;
configuration.videoSize = CGSizeMake(360, 640);
}
break;
case LFLiveVideoQuality_Low2:{
break;
case LFLiveVideoQuality_Low2:
{
configuration.sessionPreset = LFCaptureSessionPreset360x640;
configuration.videoFrameRate = 24;
configuration.videoMaxFrameRate = 24;
@@ -48,8 +48,9 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(360, 640);
}
break;
case LFLiveVideoQuality_Low3: {
break;
case LFLiveVideoQuality_Low3:
{
configuration.sessionPreset = LFCaptureSessionPreset360x640;
configuration.videoFrameRate = 30;
configuration.videoMaxFrameRate = 30;
@@ -59,8 +60,9 @@
configuration.videoMinBitRate = 600 * 1000;
configuration.videoSize = CGSizeMake(360, 640);
}
break;
case LFLiveVideoQuality_Medium1:{
break;
case LFLiveVideoQuality_Medium1:
{
configuration.sessionPreset = LFCaptureSessionPreset540x960;
configuration.videoFrameRate = 15;
configuration.videoMaxFrameRate = 15;
@@ -70,8 +72,9 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(540, 960);
}
break;
case LFLiveVideoQuality_Medium2:{
break;
case LFLiveVideoQuality_Medium2:
{
configuration.sessionPreset = LFCaptureSessionPreset540x960;
configuration.videoFrameRate = 24;
configuration.videoMaxFrameRate = 24;
@@ -81,8 +84,9 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(540, 960);
}
break;
case LFLiveVideoQuality_Medium3:{
break;
case LFLiveVideoQuality_Medium3:
{
configuration.sessionPreset = LFCaptureSessionPreset540x960;
configuration.videoFrameRate = 30;
configuration.videoMaxFrameRate = 30;
@@ -92,8 +96,9 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(540, 960);
}
break;
case LFLiveVideoQuality_High1:{
break;
case LFLiveVideoQuality_High1:
{
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
configuration.videoFrameRate = 15;
configuration.videoMaxFrameRate = 15;
@@ -103,8 +108,9 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(720, 1280);
}
break;
case LFLiveVideoQuality_High2:{
break;
case LFLiveVideoQuality_High2:
{
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
configuration.videoFrameRate = 24;
configuration.videoMaxFrameRate = 24;
@@ -114,8 +120,9 @@
configuration.videoMinBitRate = 800 * 1000;
configuration.videoSize = CGSizeMake(720, 1280);
}
break;
case LFLiveVideoQuality_High3:{
break;
case LFLiveVideoQuality_High3:
{
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
configuration.videoFrameRate = 30;
configuration.videoMaxFrameRate = 30;
@@ -125,7 +132,7 @@
configuration.videoMinBitRate = 500 * 1000;
configuration.videoSize = CGSizeMake(720, 1280);
}
break;
break;
default:
break;
}
@@ -139,40 +146,35 @@
configuration.videoSize = CGSizeMake(size.width, size.height);
}
return configuration;
}
#pragma mark -- Setter Getter
- (NSString *)avSessionPreset {
NSString *avSessionPreset = nil;
switch (self.sessionPreset) {
case LFCaptureSessionPreset360x640:{
case LFCaptureSessionPreset360x640:
{
avSessionPreset = AVCaptureSessionPreset640x480;
}
break;
case LFCaptureSessionPreset540x960:{
break;
case LFCaptureSessionPreset540x960:
{
avSessionPreset = AVCaptureSessionPresetiFrame960x540;
}
break;
case LFCaptureSessionPreset720x1280:{
break;
case LFCaptureSessionPreset720x1280:
{
avSessionPreset = AVCaptureSessionPreset1280x720;
}
break;
break;
default: {
avSessionPreset = AVCaptureSessionPreset640x480;
}
break;
break;
}
return avSessionPreset;
}
- (CGSize)videoSize{
if(_videoSizeRespectingAspectRatio){
return self.aspectRatioVideoSize;
}
return _videoSize;
}
- (void)setVideoMaxBitRate:(NSUInteger)videoMaxBitRate {
if (videoMaxBitRate <= _videoBitRate) return;
_videoMaxBitRate = videoMaxBitRate;
@@ -193,31 +195,15 @@
_videoMinFrameRate = videoMinFrameRate;
}
- (void)setSessionPreset:(LFLiveVideoSessionPreset)sessionPreset{
_sessionPreset = sessionPreset;
_sessionPreset = [self supportSessionPreset:sessionPreset];
}
#pragma mark -- Custom Method
- (LFLiveVideoSessionPreset)supportSessionPreset:(LFLiveVideoSessionPreset)sessionPreset {
NSString *avSessionPreset = [self avSessionPreset];
AVCaptureSession *session = [[AVCaptureSession alloc] init];
AVCaptureDevice *inputCamera;
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices){
if ([device position] == AVCaptureDevicePositionFront){
inputCamera = device;
}
}
AVCaptureDeviceInput *videoInput = [[AVCaptureDeviceInput alloc] initWithDevice:inputCamera error:nil];
if ([session canAddInput:videoInput]){
[session addInput:videoInput];
}
if (![session canSetSessionPreset:self.avSessionPreset]) {
if (![session canSetSessionPreset:avSessionPreset]) {
if (sessionPreset == LFCaptureSessionPreset720x1280) {
sessionPreset = LFCaptureSessionPreset540x960;
if (![session canSetSessionPreset:self.avSessionPreset]) {
if (![session canSetSessionPreset:avSessionPreset]) {
sessionPreset = LFCaptureSessionPreset360x640;
}
} else if (sessionPreset == LFCaptureSessionPreset540x960) {
@@ -227,71 +213,24 @@
return sessionPreset;
}
- (CGSize)captureOutVideoSize{
CGSize videoSize = CGSizeZero;
switch (_sessionPreset) {
case LFCaptureSessionPreset360x640:{
videoSize = CGSizeMake(360, 640);
}
break;
case LFCaptureSessionPreset540x960:{
videoSize = CGSizeMake(540, 960);
}
break;
case LFCaptureSessionPreset720x1280:{
videoSize = CGSizeMake(720, 1280);
}
break;
default:{
videoSize = CGSizeMake(360, 640);
}
break;
}
if(self.landscape){
return CGSizeMake(videoSize.height, videoSize.width);
}
return videoSize;
}
- (CGSize)aspectRatioVideoSize{
CGSize size = AVMakeRectWithAspectRatioInsideRect(self.captureOutVideoSize, CGRectMake(0, 0, _videoSize.width, _videoSize.height)).size;
NSInteger width = ceil(size.width);
NSInteger height = ceil(size.height);
if(width %2 != 0) width = width - 1;
if(height %2 != 0) height = height - 1;
return CGSizeMake(width, height);
}
#pragma mark -- encoder
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:[NSValue valueWithCGSize:self.videoSize] forKey:@"videoSize"];
[aCoder encodeObject:@(self.videoFrameRate) forKey:@"videoFrameRate"];
[aCoder encodeObject:@(self.videoMaxFrameRate) forKey:@"videoMaxFrameRate"];
[aCoder encodeObject:@(self.videoMinFrameRate) forKey:@"videoMinFrameRate"];
[aCoder encodeObject:@(self.videoMaxKeyframeInterval) forKey:@"videoMaxKeyframeInterval"];
[aCoder encodeObject:@(self.videoBitRate) forKey:@"videoBitRate"];
[aCoder encodeObject:@(self.videoMaxBitRate) forKey:@"videoMaxBitRate"];
[aCoder encodeObject:@(self.videoMinBitRate) forKey:@"videoMinBitRate"];
[aCoder encodeObject:@(self.sessionPreset) forKey:@"sessionPreset"];
[aCoder encodeObject:@(self.landscape) forKey:@"landscape"];
[aCoder encodeObject:@(self.videoSizeRespectingAspectRatio) forKey:@"videoSizeRespectingAspectRatio"];
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
_videoSize = [[aDecoder decodeObjectForKey:@"videoSize"] CGSizeValue];
_videoFrameRate = [[aDecoder decodeObjectForKey:@"videoFrameRate"] unsignedIntegerValue];
_videoMaxFrameRate = [[aDecoder decodeObjectForKey:@"videoMaxFrameRate"] unsignedIntegerValue];
_videoMinFrameRate = [[aDecoder decodeObjectForKey:@"videoMinFrameRate"] unsignedIntegerValue];
_videoMaxKeyframeInterval = [[aDecoder decodeObjectForKey:@"videoMaxKeyframeInterval"] unsignedIntegerValue];
_videoBitRate = [[aDecoder decodeObjectForKey:@"videoBitRate"] unsignedIntegerValue];
_videoMaxBitRate = [[aDecoder decodeObjectForKey:@"videoMaxBitRate"] unsignedIntegerValue];
_videoMinBitRate = [[aDecoder decodeObjectForKey:@"videoMinBitRate"] unsignedIntegerValue];
_sessionPreset = [[aDecoder decodeObjectForKey:@"sessionPreset"] unsignedIntegerValue];
_landscape = [[aDecoder decodeObjectForKey:@"landscape"] unsignedIntegerValue];
_videoSizeRespectingAspectRatio = [[aDecoder decodeObjectForKey:@"videoSizeRespectingAspectRatio"] unsignedIntegerValue];
return self;
}
@@ -307,8 +246,7 @@
@(self.videoMinBitRate),
self.avSessionPreset,
@(self.sessionPreset),
@(self.landscape),
@(self.videoSizeRespectingAspectRatio)];
@(self.landscape), ];
for (NSObject *value in values) {
hash ^= value.hash;
@@ -333,8 +271,7 @@
object.videoMinBitRate == self.videoMinBitRate &&
[object.avSessionPreset isEqualToString:self.avSessionPreset] &&
object.sessionPreset == self.sessionPreset &&
object.landscape == self.landscape &&
object.videoSizeRespectingAspectRatio == self.videoSizeRespectingAspectRatio;
object.landscape == self.landscape;
}
}
@@ -347,7 +284,6 @@
NSMutableString *desc = @"".mutableCopy;
[desc appendFormat:@"<LFLiveVideoConfiguration: %p>", self];
[desc appendFormat:@" videoSize:%@", NSStringFromCGSize(self.videoSize)];
[desc appendFormat:@" videoSizeRespectingAspectRatio:%zi",self.videoSizeRespectingAspectRatio];
[desc appendFormat:@" videoFrameRate:%zi", self.videoFrameRate];
[desc appendFormat:@" videoMaxFrameRate:%zi", self.videoMaxFrameRate];
[desc appendFormat:@" videoMinFrameRate:%zi", self.videoMinFrameRate];
+1 -2
View File
@@ -45,7 +45,6 @@ typedef NS_ENUM (NSUInteger, LFLiveSocketErrorCode) {
@property (nonatomic, strong) LFLiveAudioConfiguration *audioConfiguration;
///视频配置
@property (nonatomic, strong) LFLiveVideoConfiguration *videoConfiguration;
///是否丢帧
@property (nonatomic, assign) BOOL needDropFrame;
@end
+2 -8
View File
@@ -69,17 +69,13 @@ SAVC(mp4a);
@implementation LFStreamRTMPSocket
#pragma mark -- LFStreamSocket
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream{
return [self initWithStream:stream reconnectInterval:0 reconnectCount:0];
}
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream reconnectInterval:(NSInteger)reconnectInterval reconnectCount:(NSInteger)reconnectCount{
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream videoSize:(CGSize)videoSize reconnectInterval:(NSInteger)reconnectInterval reconnectCount:(NSInteger)reconnectCount {
if (!stream) @throw [NSException exceptionWithName:@"LFStreamRtmpSocket init error" reason:@"stream is nil" userInfo:nil];
if (self = [super init]) {
_stream = stream;
if (reconnectInterval > 0) _reconnectInterval = reconnectInterval;
else _reconnectInterval = RetryTimesMargin;
if (reconnectCount > 0) _reconnectCount = reconnectCount;
else _reconnectCount = RetryTimesBreaken;
@@ -256,7 +252,6 @@ SAVC(mp4a);
_rtmp->m_userData = (__bridge void *)self;
_rtmp->m_msgCounter = 1;
_rtmp->Link.timeout = RTMP_RECEIVE_TIMEOUT;
//设置可写,即发布流,这个函数必须在连接前使用,否则无效
PILI_RTMP_EnableWrite(_rtmp);
@@ -538,7 +533,6 @@ void ConnectionTimeCallback(PILI_CONNECTION_TIME *conn_time, void *userData) {
if (!_buffer) {
_buffer = [[LFStreamingBuffer alloc] init];
_buffer.delegate = self;
_buffer.needDropFrame = self.stream.needDropFrame;
}
return _buffer;
}
+2 -1
View File
@@ -32,5 +32,6 @@
- (void)setDelegate:(nullable id <LFStreamSocketDelegate>)delegate;
@optional
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream;
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream reconnectInterval:(NSInteger)reconnectInterval reconnectCount:(NSInteger)reconnectCount;
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream videoSize:(CGSize)videoSize;
- (nullable instancetype)initWithStream:(nullable LFLiveStreamInfo *)stream videoSize:(CGSize)videoSize reconnectInterval:(NSInteger)reconnectInterval reconnectCount:(NSInteger)reconnectCount;
@end
-3
View File
@@ -27,9 +27,6 @@ typedef NS_ENUM (NSUInteger, LFLiveBuffferState) {
@interface LFStreamingBuffer : NSObject
/** The needDropFrame control Dynamic frame loss ,default is YES */
@property (nonatomic, assign) BOOL needDropFrame;
/** The delegate of the buffer. buffer callback */
@property (nullable, nonatomic, weak) id <LFStreamingBufferDelegate> delegate;
+14 -20
View File
@@ -41,7 +41,6 @@ static const NSUInteger defaultSendBufferMaxCount = 600;///< 最大缓冲区为6
self.maxCount = defaultSendBufferMaxCount;
self.lastDropFrames = 0;
self.startTimer = NO;
self.needDropFrame = YES;
}
return self;
}
@@ -92,26 +91,21 @@ static const NSUInteger defaultSendBufferMaxCount = 600;///< 最大缓冲区为6
- (void)removeExpireFrame {
if (self.list.count < self.maxCount) return;
if(self.needDropFrame){
NSArray *pFrames = [self expirePFrames];///< P到第一个I之间的p帧
self.lastDropFrames += [pFrames count];
if (pFrames && pFrames.count > 0) {
[self.list removeObjectsInArray:pFrames];
return;
}
NSArray *iFrames = [self expireIFrames];///<  I帧I帧可能对应多个nal
self.lastDropFrames += [iFrames count];
if (iFrames) {
[self.list removeObjectsInArray:iFrames];
return;
}
[self.list removeAllObjects];
}else{
[self.list lfPopFirstObject];
NSArray *pFrames = [self expirePFrames];///< P到第一个I之间的p帧
self.lastDropFrames += [pFrames count];
if (pFrames && pFrames.count > 0) {
[self.list removeObjectsInArray:pFrames];
return;
}
NSArray *iFrames = [self expireIFrames];///<  I帧I帧可能对应多个nal
self.lastDropFrames += [iFrames count];
if (iFrames) {
[self.list removeObjectsInArray:iFrames];
return;
}
[self.list removeAllObjects];
}
- (NSArray *)expirePFrames {
@@ -8,8 +8,6 @@
/* Begin PBXBuildFile section */
81E848D8BD2C446C2DD4876A /* libPods-LFLiveKitDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FD9F92833FE7856CDDD3CED /* libPods-LFLiveKitDemo.a */; };
84C7AFA71D52F75C00614703 /* ios-29x29.png in Resources */ = {isa = PBXBuildFile; fileRef = 84C7AFA61D52F75C00614703 /* ios-29x29.png */; };
A9DB2F10F7A29BE365D7CA5A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 91E73D3676F527F2A7BD7C6C /* libPods.a */; };
B2D23E7F1D348F3D00B34CA8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D23E7E1D348F3D00B34CA8 /* main.m */; };
B2D23E821D348F3D00B34CA8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D23E811D348F3D00B34CA8 /* AppDelegate.m */; };
B2D23E851D348F3D00B34CA8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D23E841D348F3D00B34CA8 /* ViewController.m */; };
@@ -33,9 +31,7 @@
/* Begin PBXFileReference section */
6FD9F92833FE7856CDDD3CED /* libPods-LFLiveKitDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-LFLiveKitDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
84C7AFA61D52F75C00614703 /* ios-29x29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ios-29x29.png"; sourceTree = "<group>"; };
8FAAEBE1A4F099C69588B394 /* Pods-LFLiveKitDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.release.xcconfig"; sourceTree = "<group>"; };
91E73D3676F527F2A7BD7C6C /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
AFD491825C5DB2AD871189B5 /* Pods-LFLiveKitDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.debug.xcconfig"; sourceTree = "<group>"; };
B2D23E7A1D348F3D00B34CA8 /* LFLiveKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFLiveKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
B2D23E7E1D348F3D00B34CA8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@@ -71,7 +67,6 @@
buildActionMask = 2147483647;
files = (
81E848D8BD2C446C2DD4876A /* libPods-LFLiveKitDemo.a in Frameworks */,
A9DB2F10F7A29BE365D7CA5A /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -165,7 +160,6 @@
B2D23EA51D348F7100B34CA8 /* camra_preview@3x.png */,
B2D23EA61D348F7100B34CA8 /* close_preview@2x.png */,
B2D23EA71D348F7100B34CA8 /* close_preview@3x.png */,
84C7AFA61D52F75C00614703 /* ios-29x29.png */,
);
path = images;
sourceTree = "<group>";
@@ -174,7 +168,6 @@
isa = PBXGroup;
children = (
6FD9F92833FE7856CDDD3CED /* libPods-LFLiveKitDemo.a */,
91E73D3676F527F2A7BD7C6C /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -186,11 +179,12 @@
isa = PBXNativeTarget;
buildConfigurationList = B2D23E911D348F3D00B34CA8 /* Build configuration list for PBXNativeTarget "LFLiveKitDemo" */;
buildPhases = (
D4A28B8E7B3F14FE7B5CE784 /* Check Pods Manifest.lock */,
6A9D2ED37E623D4A31A8D2C9 /* 📦 Check Pods Manifest.lock */,
B2D23E761D348F3D00B34CA8 /* Sources */,
B2D23E771D348F3D00B34CA8 /* Frameworks */,
B2D23E781D348F3D00B34CA8 /* Resources */,
3E1A58B9B801624E131D1416 /* Copy Pods Resources */,
34EEB2C8F5E0D371D13B66CA /* 📦 Copy Pods Resources */,
7336E9C92EDCA6C7449F2624 /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -240,7 +234,6 @@
files = (
B2D23E8D1D348F3D00B34CA8 /* LaunchScreen.storyboard in Resources */,
B2D23EAA1D348F7100B34CA8 /* Assets.xcassets in Resources */,
84C7AFA71D52F75C00614703 /* ios-29x29.png in Resources */,
B2D23EAC1D348F7100B34CA8 /* Main.storyboard in Resources */,
B2D23EAB1D348F7100B34CA8 /* LaunchScreen.storyboard in Resources */,
B2D23EB21D348F7100B34CA8 /* camra_beauty_close@3x.png in Resources */,
@@ -258,29 +251,29 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3E1A58B9B801624E131D1416 /* Copy Pods Resources */ = {
34EEB2C8F5E0D371D13B66CA /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-resources.sh\"\n";
showEnvVarsInLog = 0;
};
D4A28B8E7B3F14FE7B5CE784 /* Check Pods Manifest.lock */ = {
6A9D2ED37E623D4A31A8D2C9 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -288,6 +281,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
7336E9C92EDCA6C7449F2624 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>LFLiveKitDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B2D23E791D348F3D00B34CA8</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "0"
version = "2.0">
</Bucket>
+7 -14
View File
@@ -156,7 +156,7 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
/***  默认分辨率368 640 音频:44.1 iphone6以上48 双声道 方向竖屏 ***/
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfigurationForQuality:LFLiveVideoQuality_Low2 landscape:NO] captureType:LFLiveCaptureDefaultMask];
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfigurationForQuality:LFLiveVideoQuality_Medium3 landscape:NO]];
/**   自己定制单声道 */
/*
@@ -213,8 +213,8 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 15;
videoConfiguration.videoMaxKeyframeInterval = 30;
videoConfiguration.landscape = NO;
videoConfiguration.sessionPreset = LFCaptureSessionPreset360x640;
videoConfiguration.orientation = UIInterfaceOrientationPortrait;
videoConfiguration.sessionPreset = LFCaptureSessionPreset720x1280;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration];
*/
@@ -239,18 +239,11 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
videoConfiguration.sessionPreset = LFCaptureSessionPreset720x1280;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration];
*/
*/
_session.delegate = self;
_session.showDebugInfo = NO;
_session.preView = self;
UIImageView *imageView = [[UIImageView alloc] init];
imageView.alpha = 0.8;
imageView.frame = CGRectMake(100, 100, 29, 29);
imageView.image = [UIImage imageNamed:@"ios-29x29"];
_session.warterMarkView = imageView;
}
return _session;
}
@@ -311,8 +304,8 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
_beautyButton = [UIButton new];
_beautyButton.size = CGSizeMake(44, 44);
_beautyButton.origin = CGPointMake(_cameraButton.left - 10 - _beautyButton.width, 20);
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty"] forState:UIControlStateNormal];
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty_close"] forState:UIControlStateSelected];
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty"] forState:UIControlStateSelected];
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty_close"] forState:UIControlStateNormal];
_beautyButton.exclusiveTouch = YES;
__weak typeof(self) _self = self;
[_beautyButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id sender) {
@@ -341,7 +334,7 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
if (_self.startLiveButton.selected) {
[_self.startLiveButton setTitle:@"结束直播" forState:UIControlStateNormal];
LFLiveStreamInfo *stream = [LFLiveStreamInfo new];
stream.url = @"rtmp://live.hkstv.hk.lxdns.com:1935/live/stream153";
stream.url = @"rtmp://live.hkstv.hk.lxdns.com:1935/live/stream123";
[_self.session startLive:stream];
} else {
[_self.startLiveButton setTitle:@"开始直播" forState:UIControlStateNormal];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

+1 -2
View File
@@ -2,7 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios,'7.0'
target 'LFLiveKitDemo' do
pod 'LFLiveKit', path: '../'
end
pod 'LFLiveKit', path: '../'
-3
View File
@@ -26,10 +26,7 @@ LFLiveKit
- [x] Switch camera position
- [x] Audio Mute
- [x] Support Send Buffer
- [x] Support WaterMark
- [x] Swift Support
- [x] Support Single Video or Audio
- [x] Support External input video or audio(Screen recording or Peripheral)
- [ ] ~~FLV package and send~~
## Requirements