Add preliminary handling of timestamp invalidation

- Add preliminary (yet to be tested) handling of timestamp invalidation
  issues that can happen with specific devices, where timestamps can
  reset or go backward/forward in time with no rhyme or reason.  Spent
  the entire day just trying to figure out the best way to handle this.

  If both audio and video are present, it will increment a reference
  counter if video timestamps invalidate, and decrement the reference
  counter when the audio timestamps invalidate.  When the reference
  counter is not 0, it will not send audio as the audio will have
  invalid timing.  What this does is it ensures audio data will never go
  out of bounds in relation to the video, and waits for both audio and
  video timestamps to "jump" together before resuming audio.

- Moved async video frame timing adjustment code into
  obs_source_getframe instead so it's automatically handled whenever
  called.

- Removed the 'audio wait buffer' as it was an unnecessary complexity
  that could have had problems in the future.  Instead, audio will not
  be added until video starts for sources that have both async
  audio/video.  Audio could have buffered for too long of a time anyway,
  who knows what devices are going to do.

- Fixed a minor conversion warning in audio-io.c
This commit is contained in:
jp9000
2014-01-12 02:40:51 -07:00
parent fc219e7d1d
commit 9f1a3c3112
3 changed files with 100 additions and 102 deletions

View File

@@ -127,7 +127,7 @@ static inline void mix_audio_line(struct audio_output *audio,
size -= time_offset;
size_t pop_size = min_uint64(size, line->buffer.size);
size_t pop_size = (size_t)min_uint64(size, line->buffer.size);
circlebuf_pop_front(&line->buffer,
audio->mix_buffer.array + time_offset,
pop_size);