Mercurial > libavformat.hg
comparison beosaudio.cpp @ 108:c1c8a0777bdb libavformat
Add latency check, the Media Kit shoul repport it, but this seems broken.
| author | mmu_man |
|---|---|
| date | Fri, 18 Apr 2003 16:22:12 +0000 |
| parents | 265d01c2248f |
| children | 41d4f3a86c98 |
comparison
equal
deleted
inserted
replaced
| 107:d73becdbbda5 | 108:c1c8a0777bdb |
|---|---|
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 /* enable performance checks */ | 38 /* enable performance checks */ |
| 39 //#define PERF_CHECK | 39 //#define PERF_CHECK |
| 40 | 40 |
| 41 /* enable Media Kit latency checks */ | |
| 42 //#define LATENCY_CHECK | |
| 43 | |
| 41 #define AUDIO_BLOCK_SIZE 4096 | 44 #define AUDIO_BLOCK_SIZE 4096 |
| 42 //#define AUDIO_BLOCK_SIZE 2048 | 45 //#define AUDIO_BLOCK_SIZE 2048 |
| 43 #define AUDIO_BLOCK_COUNT 8 | 46 #define AUDIO_BLOCK_COUNT 8 |
| 44 | 47 |
| 45 #define AUDIO_BUFFER_SIZE (AUDIO_BLOCK_SIZE*AUDIO_BLOCK_COUNT) | 48 #define AUDIO_BUFFER_SIZE (AUDIO_BLOCK_SIZE*AUDIO_BLOCK_COUNT) |
| 298 static int audio_write_packet(AVFormatContext *s1, int stream_index, | 301 static int audio_write_packet(AVFormatContext *s1, int stream_index, |
| 299 uint8_t *buf, int size, int force_pts) | 302 uint8_t *buf, int size, int force_pts) |
| 300 { | 303 { |
| 301 AudioData *s = (AudioData *)s1->priv_data; | 304 AudioData *s = (AudioData *)s1->priv_data; |
| 302 int len, ret; | 305 int len, ret; |
| 306 #ifdef LATENCY_CHECK | |
| 307 bigtime_t lat1, lat2; | |
| 308 lat1 = s->player->Latency(); | |
| 309 #endif | |
| 303 #ifdef PERF_CHECK | 310 #ifdef PERF_CHECK |
| 304 bigtime_t t = s->starve_time; | 311 bigtime_t t = s->starve_time; |
| 305 s->starve_time = 0; | 312 s->starve_time = 0; |
| 306 printf("starve_time: %lld \n", t); | 313 printf("starve_time: %lld \n", t); |
| 307 #endif | 314 #endif |
| 320 } | 327 } |
| 321 release_sem_etc(s->output_sem, len, 0); | 328 release_sem_etc(s->output_sem, len, 0); |
| 322 buf += len; | 329 buf += len; |
| 323 size -= len; | 330 size -= len; |
| 324 } | 331 } |
| 332 #ifdef LATENCY_CHECK | |
| 333 lat2 = s->player->Latency(); | |
| 334 printf("#### BSoundPlayer::Latency(): before= %lld, after= %lld\n", lat1, lat2); | |
| 335 #endif | |
| 325 return 0; | 336 return 0; |
| 326 } | 337 } |
| 327 | 338 |
| 328 static int audio_write_trailer(AVFormatContext *s1) | 339 static int audio_write_trailer(AVFormatContext *s1) |
| 329 { | 340 { |
