mirror of https://github.com/mpv-player/mpv
ao_avfoundation: add EOF handling
This commit is contained in:
parent
aebe58203b
commit
eb996a13bc
|
@ -76,11 +76,14 @@ static void feed(struct ao *ao)
|
|||
int64_t cur_time_mp = mp_time_ns();
|
||||
int64_t end_time_av = MPMAX(p->end_time_av, cur_time_av);
|
||||
int64_t time_delta = CMTimeGetNanoseconds(CMTimeMake(request_sample_count, samplerate));
|
||||
int real_sample_count = ao_read_data(ao, data, request_sample_count, end_time_av - cur_time_av + cur_time_mp + time_delta, NULL, false, false);
|
||||
bool eof;
|
||||
int real_sample_count = ao_read_data(ao, data, request_sample_count, end_time_av - cur_time_av + cur_time_mp + time_delta, &eof, false, false);
|
||||
if (eof) {
|
||||
[p->renderer stopRequestingMediaData];
|
||||
ao_stop_streaming(ao);
|
||||
}
|
||||
if (real_sample_count == 0) {
|
||||
// avoid spinning by blocking the thread
|
||||
mp_sleep_ns(10000000);
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((err = CMBlockBufferCreateWithMemoryBlock(
|
||||
|
|
Loading…
Reference in New Issue