From a51944b2c5da8cc334fc504b3e6debf76aeeeda8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 31 Aug 2016 15:38:44 -0400 Subject: [PATCH] cleanup, remove separate audio and video queues --- src/zm_packetqueue.cpp | 48 ++++++++---------------------------------- src/zm_packetqueue.h | 14 ++++-------- 2 files changed, 13 insertions(+), 49 deletions(-) diff --git a/src/zm_packetqueue.cpp b/src/zm_packetqueue.cpp index f9459d112..fbf48613d 100644 --- a/src/zm_packetqueue.cpp +++ b/src/zm_packetqueue.cpp @@ -24,27 +24,18 @@ using namespace std; -zm_packetqueue::zm_packetqueue() - : MaxVideoQueueSize(VIDEO_QUEUESIZE) -, MaxAudioQueueSize(AUDIO_QUEUESIZE) { +zm_packetqueue::zm_packetqueue(){ + } zm_packetqueue::~zm_packetqueue() { + } -bool zm_packetqueue::queueVideoPacket(AVPacket* packet) { - return queuePacket(VideoQueue, packet); -} - -bool zm_packetqueue::queueAudioPacket(AVPacket* packet) -{ - return queuePacket(AudioQueue, packet); -} - -bool zm_packetqueue::queuePacket(queue& pktQueue, AVPacket* packet){ +bool zm_packetqueue::queuePacket( AVPacket* packet ) { AVPacket input_ref = { 0 }; - if (av_packet_ref(&input_ref, packet) < 0){ + if ( av_packet_ref(&input_ref, packet) < 0 ) { return false; } pktQueue.push(*packet); @@ -52,10 +43,8 @@ bool zm_packetqueue::queuePacket(queue& pktQueue, AVPacket* packet){ return true; } -bool zm_packetqueue::popPacket(queue& pktQueue, AVPacket* packet) -{ - if (pktQueue.empty()) - { +bool zm_packetqueue::popPacket( AVPacket* packet ) { + if ( pktQueue.empty() ) { return false; } @@ -65,27 +54,8 @@ bool zm_packetqueue::popPacket(queue& pktQueue, AVPacket* packet) return true; } -void zm_packetqueue::clearQueue(std::queue& pktQueue) -{ - while(!pktQueue.empty()) - { +void zm_packetqueue::clearQueue() { + while(!pktQueue.empty()) { pktQueue.pop(); } } - -void zm_packetqueue::clearQueues() -{ - clearQueue(VideoQueue); - clearQueue(AudioQueue); -} - -bool zm_packetqueue::popAudioPacket(AVPacket* packet) -{ - return popPacket(AudioQueue, packet); -} - -bool zm_packetqueue::popVideoPacket(AVPacket* packet) -{ - return popPacket(VideoQueue, packet); -} - diff --git a/src/zm_packetqueue.h b/src/zm_packetqueue.h index 7a016037f..f142dba45 100644 --- a/src/zm_packetqueue.h +++ b/src/zm_packetqueue.h @@ -33,19 +33,13 @@ class zm_packetqueue { public: zm_packetqueue(); virtual ~zm_packetqueue(); - bool queuePacket(std::queue& pktQueue, AVPacket* packet); - bool queueVideoPacket(AVPacket* packet); - bool queueAudioPacket(AVPacket* packet); - bool popPacket(std::queue& pktQueue, AVPacket* packet); + bool queuePacket( AVPacket* packet ); + bool popPacket( AVPacket* packet ); bool popVideoPacket(AVPacket* packet); bool popAudioPacket(AVPacket* packet); - void clearQueues(); - void clearQueue(std::queue& pktQueue); + void clearQueue( ); private: - int MaxVideoQueueSize; - int MaxAudioQueueSize; - std::queue VideoQueue; - std::queue AudioQueue; + std::queue pktQueue; };