Skip to content

Commit

Permalink
Minor improvements (#9)
Browse files Browse the repository at this point in the history
* update to Xcode12

* revert dependency version

* minor fix

* minor improvements
  • Loading branch information
liuxuan30 committed Mar 7, 2021
1 parent baacb70 commit dc2529f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions TelloSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -542,6 +543,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
8 changes: 6 additions & 2 deletions TelloVideoDecoder/TelloVideoH264Decoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class TelloVideoH264Decoder {
}

/// This is a wrapper of VTDecompressionSessionDecodeFrame(_:sampleBuffer:flags:infoFlagsOut:outputHandler:)
///
/// This function cannot be called with a session created with a VTDecompressionOutputCallbackRecord.
/// - Parameters:
/// - sampleBuffer: CMSampleBuffer
/// - outputHandler: @escaping VTDecompressionOutputHandler
Expand All @@ -76,6 +78,8 @@ public class TelloVideoH264Decoder {
/// - Returns: CMSampleBuffer?
public func getCMSampleBuffer(from nalu: NALUnit) -> CMSampleBuffer? {
// print("Read Nalu size \(nalu.count)");
guard nalu.count > 4 else { return nil }

var mNalu = nalu
let naluType = nalu[4] & 0x1f

Expand Down Expand Up @@ -110,7 +114,7 @@ public class TelloVideoH264Decoder {
guard streamBuffer.count != 0 else { return nil }

//make sure start with start code
if streamBuffer.count < 5 || Array(streamBuffer[0...3]) != startCode {
if streamBuffer.count < 5 || streamBuffer[0...3] != startCode[...] {
return nil
}

Expand All @@ -136,7 +140,7 @@ public class TelloVideoH264Decoder {
guard streamBuffer.count != 0 else { return nil }

//make sure start with start code
if streamBuffer.count < 5 || Array(streamBuffer[0...3]) != startCode {
if streamBuffer.count < 5 || streamBuffer[0...3] != startCode[...] {
return nil
}

Expand Down

0 comments on commit dc2529f

Please sign in to comment.