avc: Track the number of enqueued and dequeued packets

This commit is contained in:
Quentin Smith 2011-04-19 13:53:54 -04:00 committed by David Schleef
parent 5ce26c5cc7
commit edc93f89e1
2 changed files with 13 additions and 1 deletions

View file

@ -237,6 +237,7 @@ MyStructuredDataPushProc (UInt32 CycleDataCount,
pCycleData[cycle].pBuf[sourcePacket], kMPEG2TSPacketSize);
gst_atomic_queue_push (avcsrc->queue, buffer);
avcsrc->packets_enqueued++;
}
}
@ -321,6 +322,9 @@ gst_avc_src_stop (GstBaseSrc * src)
// Forget about the device (don't destroy it; pAVCDeviceController manages it)
avcsrc->pAVCDevice = nil;
GST_DEBUG("Packets enqueued = %llu", avcsrc->packets_enqueued);
GST_DEBUG("Packets dequeued = %llu", avcsrc->packets_dequeued);
while ((buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue))) != NULL) {
gst_buffer_unref (buffer);
}
@ -358,7 +362,10 @@ gst_avc_src_event (GstBaseSrc * src, GstEvent * event)
{
GstAVCSrc *avcsrc = GST_AVC_SRC (src);
GST_DEBUG_OBJECT (avcsrc, "event");
GST_DEBUG_OBJECT (avcsrc, "event of type '%s'", GST_EVENT_TYPE_NAME(event));
GST_DEBUG("Packets enqueued = %llu, dequeued = %llu",
avcsrc->packets_enqueued, avcsrc->packets_dequeued);
return TRUE;
}
@ -390,6 +397,8 @@ gst_avc_src_create (GstBaseSrc * src, guint64 offset, guint size,
*buf = buffer;
avcsrc->packets_dequeued++;
return GST_FLOW_OK;
}

View file

@ -46,6 +46,9 @@ struct _GstAVCSrc
AVCDeviceStream *pAVCDeviceStream;
int deviceIndex;
guint64 packets_enqueued;
guint64 packets_dequeued;
GstAtomicQueue *queue;
GCond *cond;
GMutex *queue_lock;