summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordon.darling <don.darling@24075187-2e39-4e88-bbb8-bc8aa768f540>2010-11-16 20:45:56 +0000
committerdon.darling <don.darling@24075187-2e39-4e88-bbb8-bc8aa768f540>2010-11-16 20:45:56 +0000
commit0bb33e2f9b9f3cad34078c6c0af63f2a7a69635f (patch)
tree499dd62e661e50e358b9507dc2acdb0c94bad06c
parent42fe8dd79f47a3d21c2d4d4c82c0fcdfd6f63ed6 (diff)
Cache the frameDuration in TIVidenc1.
This is better than calculating it every time we encode a frame. git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@864 24075187-2e39-4e88-bbb8-bc8aa768f540
-rw-r--r--gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c12
-rw-r--r--gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.h1
2 files changed, 8 insertions, 5 deletions
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
index f0b6351..941cf5b 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
@@ -437,6 +437,7 @@ static void gst_tividenc1_init(GstTIVidenc1 *videnc1, GstTIVidenc1Class *gclass)
videnc1->numOutputBufs = 0;
videnc1->numInputBufs = 0;
videnc1->upstreamBufSize = -1;
+ videnc1->frameDuration = GST_CLOCK_TIME_NONE;
videnc1->hCcv = NULL;
videnc1->hFc = NULL;
videnc1->rateControlPreset = 1;
@@ -1249,6 +1250,9 @@ static gboolean gst_tividenc1_init_video(GstTIVidenc1 *videnc1)
videnc1->sinkAdapter = gst_adapter_new();
}
+ /* Calculate the duration of a single frame in this stream */
+ videnc1->frameDuration = gst_tividenc1_frame_duration(videnc1);
+
/* Start the codec */
if (!gst_tividenc1_codec_start(videnc1)) {
GST_ELEMENT_ERROR(videnc1, RESOURCE, FAILED,
@@ -1293,6 +1297,8 @@ static gboolean gst_tividenc1_exit_video(GstTIVidenc1 *videnc1)
videnc1->codec_data = NULL;
}
+ videnc1->frameDuration = GST_CLOCK_TIME_NONE;
+
/* Stop the codec */
if (gst_tividenc1_codec_stop(videnc1) < 0) {
GST_ELEMENT_ERROR(videnc1, RESOURCE, FAILED,
@@ -1636,14 +1642,10 @@ gst_tividenc1_encode(GstTIVidenc1 *videnc1, GstBuffer *inBuf,
Buffer_Handle hDstBuf = NULL;
Buffer_Handle hInBuf = NULL;
GstClockTime encDataTime;
- GstClockTime frameDuration;
Int ret;
*outBuf = NULL;
- /* Calculate the duration of a single frame in this stream */
- frameDuration = gst_tividenc1_frame_duration(videnc1);
-
/* set graphics attrs for input buffer */
gfxAttrs.dim.width = videnc1->width;
gfxAttrs.bAttrs.reference = FALSE;
@@ -1733,7 +1735,7 @@ gst_tividenc1_encode(GstTIVidenc1 *videnc1, GstBuffer *inBuf,
GST_CLOCK_TIME_IS_VALID(encDataTime)) {
GST_LOG("video timestamp value: %llu\n", encDataTime);
GST_BUFFER_TIMESTAMP(*outBuf) = encDataTime;
- GST_BUFFER_DURATION(*outBuf) = frameDuration;
+ GST_BUFFER_DURATION(*outBuf) = videnc1->frameDuration;
}
else {
GST_BUFFER_TIMESTAMP(*outBuf) = GST_CLOCK_TIME_NONE;
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.h
index 35863c0..f665bc8 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.h
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.h
@@ -89,6 +89,7 @@ struct _GstTIVidenc1
/* Framerate */
GValue framerate;
+ GstClockTime frameDuration;
/* Frame resolution */
gint width;