Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Rename audioRecordOffset to audioToVideoRecordStartOffset to make the…
Browse files Browse the repository at this point in the history
… name clearer
  • Loading branch information
anton-smule committed Oct 12, 2017
1 parent 8a8bcbb commit 9f486a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/PBJVision.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static CGFloat const PBJVideoBitRate1280x750 = 5000000 * 8; // 40bmps
@property (nonatomic, readonly) NSMutableArray *luminanceValues;

@property (nonatomic, readonly) Float64 averageISO;
@property (nonatomic) CMTime audioRecordOffset;
@property (nonatomic) CMTime audioToVideoRecordStartOffset;

- (void)setAudioStartTimestamp:(CMTime)audioStartTimestamp;
- (void)setAudioStopTimestamp:(CMTime)audioStopTimestamp;
Expand Down
16 changes: 8 additions & 8 deletions Source/PBJVision.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ @interface PBJVision () <

CMTime _lastAudioTimestamp;

CMTime _audioRecordOffset;
CMTime _audioToVideoRecordStartOffset;

CMTime _lastVideoDisplayTimestamp;
CMTime _minDisplayDuration;
Expand Down Expand Up @@ -261,7 +261,7 @@ @implementation PBJVision
@synthesize maximumCaptureDuration = _maximumCaptureDuration;
@synthesize detectLowLight = _detectLowLight;
@synthesize luminanceValues = _luminanceValues;
@synthesize audioRecordOffset = _audioRecordOffset;
@synthesize audioToVideoRecordStartOffset = _audioToVideoRecordStartOffset;

+ (NSString*)hardwareString
{
Expand Down Expand Up @@ -679,8 +679,8 @@ - (AVCaptureDeviceFormat *)formatForDevice:(AVCaptureDevice*)device withDim:(NSI
- (void)setAudioStartTimestamp:(CMTime)audioStartTimestamp
{
[self _enqueueBlockOnCaptureVideoQueue:^{
_audioRecordOffset = CMTimeSubtract(_startTimestamp, audioStartTimestamp);
DLog(@"_audioRecordOffset: %f", CMTimeGetSeconds(_audioRecordOffset));
_audioToVideoRecordStartOffset = CMTimeSubtract(_startTimestamp, audioStartTimestamp);
DLog(@"_audioToVideoRecordStartOffset: %f", CMTimeGetSeconds(_audioToVideoRecordStartOffset));

if (CMTIME_IS_INVALID(_lastTimestamp)) {
_lastTimestamp = audioStartTimestamp;
Expand Down Expand Up @@ -1939,7 +1939,7 @@ - (void)startVideoCapture
_lastTimestamp = kCMTimeInvalid;
//_lastTimestamp = _startTimestamp;
_lastAudioTimestamp = kCMTimeInvalid;
_audioRecordOffset = kCMTimeInvalid;
_audioToVideoRecordStartOffset = kCMTimeInvalid;
_totalPauseTime = kCMTimeZero;
_lastPauseTimestamp = kCMTimeInvalid;

Expand Down Expand Up @@ -1994,7 +1994,7 @@ - (void)resumeVideoCapture

DLog(@"resuming video capture");

//_audioRecordOffset = kCMTimeInvalid;
//_audioToVideoRecordStartOffset = kCMTimeInvalid;
_flags.paused = NO;
_flags.interrupted = NO;

Expand Down Expand Up @@ -2210,8 +2210,8 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM

CMTime currentTimestamp = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);

if (_flags.recording && CMTIME_IS_INVALID(_audioRecordOffset)) {
// this will grab the info need to compute _audioRecordOffset
if (_flags.recording && CMTIME_IS_INVALID(_audioToVideoRecordStartOffset)) {
// this will grab the info need to compute _audioToVideoRecordStartOffset
if ([_delegate respondsToSelector:@selector(visionWillStartWritingVideo:fileURL:)]) {
[_delegate visionWillStartWritingVideo:self fileURL:_mediaWriter.outputURL];
}
Expand Down

0 comments on commit 9f486a8

Please sign in to comment.