Skip to content

Hangs on dav1d_submit_frame/dav1d_get_picture

  • Library version: 1.4.0 - 1.4.3 (static)
  • OS: iOS 15 - 17 (arm64)
  • Devices: Mostly high-performance iPhones with a large number of cores

Sometimes Dav1d hangs the application while decoding a frame, though it happens extremely rarely. The OS kills the process shortly after. The typical stack trace looks like this:

...

          app_video_player_thread
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x4109b50 dav1d_submit_frame + 55341268
3  MyApp                          0x3013acc -[MySampleBufferDecoder decodeSampleBuffer:] + 37556304
   ...

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

          dav1d-worker
0  libsystem_kernel.dylib         0x71cc __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x36e4 _pthread_cond_wait + 1228
2  MyApp                          0x417d958 dav1d_worker_task + 55752976
3  libsystem_pthread.dylib        0x10d8 thread_start + 8

...

Sometimes there may be a call to dav1d_get_picture instead of dav1d_submit_frame on app_video_player_thread.

In the application there can usually be two or three instances of Dav1dContext. Access to each context is performed from a separate thread (serial dispatch queue). Limiting the number of contexts to one does not help. Limiting thread count to 2 does not help either.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information