Skip to content

Commit

Permalink
Bug 1806605 - In VideoCaptureAvFoundation track conversions to I420 w…
Browse files Browse the repository at this point in the history
…ith a marker. r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D165825
  • Loading branch information
Pehrsons committed Jan 11, 2023
1 parent b867609 commit 8fb02be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class VideoCaptureAvFoundation : public VideoCaptureImpl {
// Id string uniquely identifying this capture source. Written on the mChecker thread only.
mozilla::Maybe<mozilla::TrackingId> mTrackingId MOZ_GUARDED_BY(api_lock_);
// Adds frame specific markers to the profiler while mTrackingId is set.
mozilla::PerformanceRecorderMulti<mozilla::CaptureStage> mPerformanceRecorder;
mozilla::PerformanceRecorderMulti<mozilla::CaptureStage> mCaptureRecorder;
mozilla::PerformanceRecorderMulti<mozilla::CopyVideoStage> mConversionRecorder;
std::atomic<ProfilerThreadId> mCallbackThreadId;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ - (void)capturer:(RTC_OBJC_TYPE(RTCVideoCapturer) * _Nonnull)capturer

int32_t VideoCaptureAvFoundation::OnFrame(webrtc::VideoFrame& aFrame) {
MutexLock lock(&api_lock_);
mConversionRecorder.Record(0);
int32_t rv = DeliverCapturedFrame(aFrame);
mPerformanceRecorder.Record(0);
mCaptureRecorder.Record(0);
return rv;
}

Expand Down Expand Up @@ -260,10 +261,13 @@ - (void)capturer:(RTC_OBJC_TYPE(RTCVideoCapturer) * _Nonnull)capturer
return CaptureStage::ImageType::Unknown;
}
};
mPerformanceRecorder.Start(
mCaptureRecorder.Start(
0, "VideoCaptureAVFoundation"_ns, *mTrackingId, aWidth, aHeight,
mCapability.map([&](const auto& aCap) { return fromWebrtcVideoType(aCap.videoType); })
.valueOr(CaptureStage::ImageType::Unknown));
if (mCapability && mCapability->videoType != webrtc::VideoType::kI420) {
mConversionRecorder.Start(0, "VideoCaptureAVFoundation"_ns, *mTrackingId, aWidth, aHeight);
}
}

void VideoCaptureAvFoundation::MaybeRegisterCallbackThread() {
Expand Down

0 comments on commit 8fb02be

Please sign in to comment.