@@ -270,6 +270,12 @@ void CameraSession::connect_video_sink(QVideoSink* sink){
270270 WallClock now = current_time ();
271271 {
272272 WriteSpinLock lg (m_frame_lock);
273+
274+ // Skip duplicate frames.
275+ if (frame.startTime () <= m_last_frame.startTime ()){
276+ return ;
277+ }
278+
273279 m_last_frame = frame;
274280 m_last_frame_timestamp = now;
275281 m_last_frame_seqnum++;
@@ -352,7 +358,7 @@ void CameraSession::startup(){
352358 if (!m_device){
353359 return ;
354360 }
355- m_logger.log (" Starting Camera: Backend = CameraQt6QVideoSink " );
361+ m_logger.log (" Starting Camera: Backend = CameraQt65QMediaCaptureSession " );
356362
357363 auto cameras = QMediaDevices::videoInputs ();
358364 const QCameraDevice* device = nullptr ;
@@ -401,8 +407,6 @@ void CameraSession::startup(){
401407 if (desired_format == nullptr ){
402408 desired_format = m_resolution_map.rbegin ()->second ;
403409 }
404- // cout << "CameraSession::m_resolutions = " << m_resolutions.size() << endl;
405- cout << " desired_format = " << desired_format->minFrameRate () << " - " << desired_format->maxFrameRate () << endl; // REMOVE
406410
407411 QSize size = desired_format->resolution ();
408412 m_resolution = Resolution (size.width (), size.height ());
@@ -432,6 +436,8 @@ void CameraSession::startup(){
432436
433437 m_camera->start ();
434438
439+ // cout << "frame rate = " << m_camera->cameraFormat().minFrameRate() << endl;
440+
435441 for (StateListener* listener : m_state_listeners){
436442 listener->post_new_source (m_device, m_resolution);
437443 }
0 commit comments