translate packet_queue.c into English

translate packet_queue.c into English
pull/166/head
xufulong 5 years ago
parent 8922e50150
commit 08a7bc7464
  1. 2
      app/src/main/cpp/AVpacket_queue.c
  2. 12
      app/src/main/cpp/AVpacket_queue.h

@ -37,7 +37,6 @@ void* queue_push(AVPacketQueue* queue, pthread_mutex_t* mutex, pthread_cond_t* c
int next_to_write;
for (;;) {
next_to_write = queue_next(queue, current);
//写的不等于读的,跳出循环
if (next_to_write != queue->next_to_read) {
break;
}
@ -51,7 +50,6 @@ void* queue_push(AVPacketQueue* queue, pthread_mutex_t* mutex, pthread_cond_t* c
void *queue_pop(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond) {
int current = queue->next_to_read;
for (;;) {
//写的不等于读的,跳出循环
if (queue->next_to_write != queue->next_to_read) {
break;
}

@ -4,22 +4,26 @@
#ifndef VIDEOPLAYER_AVPACKET_QUEUE_H
#define VIDEOPLAYER_AVPACKET_QUEUE_H
#include <pthread.h>
typedef struct AVPacketQueue {
//队列大小
//the size of queue
int size;
//指针数组
//packet array
void **packets;
//下一个写入的packet
//the packet next to write
int next_to_write;
//下一个读取的packet
//the packet next to read
int next_to_read;
} AVPacketQueue;
AVPacketQueue *queue_init(int size);
void queue_free(AVPacketQueue *queue);
void *queue_push(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond);
void *queue_pop(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond);
#endif //VIDEOPLAYER_AVPACKET_QUEUE_H
Loading…
Cancel
Save