decklinkaudiosrc: Consistently pass stream_time and stream_duration to audio/video src

It's the same value now, pass it consistently.
This commit is contained in:
Sebastian Dröge 2017-05-12 11:35:39 +02:00
parent 8494f1e709
commit 4df6be45f0
3 changed files with 12 additions and 11 deletions

View file

@ -761,7 +761,8 @@ public:
no_signal) = NULL;
void (*got_audio_packet) (GstElement * videosrc,
IDeckLinkAudioInputPacket * packet, GstClockTime capture_time,
GstClockTime packet_time, gboolean no_signal) = NULL;
GstClockTime stream_time, GstClockTime stream_duration,
gboolean no_signal) = NULL;
GstDecklinkModeEnum mode;
GstClockTime capture_time = GST_CLOCK_TIME_NONE;
GstClockTime base_time = 0;
@ -769,6 +770,7 @@ public:
GstClock *clock = NULL;
HRESULT res;
BMDTimeValue stream_time = GST_CLOCK_TIME_NONE;
BMDTimeValue stream_duration = GST_CLOCK_TIME_NONE;
g_mutex_lock (&m_input->lock);
if (m_input->videosrc) {
@ -807,7 +809,6 @@ public:
}
if (got_video_frame && videosrc && video_frame) {
BMDTimeValue stream_duration = GST_CLOCK_TIME_NONE;
IDeckLinkTimecode *dtc = 0;
res =
@ -840,7 +841,7 @@ public:
if (got_audio_packet && audiosrc && audio_packet) {
m_input->got_audio_packet (audiosrc, audio_packet, capture_time,
stream_time, no_signal);
stream_time, stream_duration, no_signal);
} else {
if (!audio_packet)
GST_DEBUG ("Received no audio packet at %" GST_TIME_FORMAT,

View file

@ -225,7 +225,7 @@ struct _GstDecklinkInput {
BMDPixelFormat format;
/* Set by the audio source */
void (*got_audio_packet) (GstElement *videosrc, IDeckLinkAudioInputPacket * packet, GstClockTime capture_time, GstClockTime packet_time, gboolean no_signal);
void (*got_audio_packet) (GstElement *videosrc, IDeckLinkAudioInputPacket * packet, GstClockTime capture_time, GstClockTime stream_time, GstClockTime stream_duration, gboolean no_signal);
GstElement *audiosrc;
gboolean audio_enabled;

View file

@ -467,7 +467,7 @@ gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
static void
gst_decklink_audio_src_got_packet (GstElement * element,
IDeckLinkAudioInputPacket * packet, GstClockTime capture_time,
GstClockTime packet_time, gboolean no_signal)
GstClockTime stream_time, GstClockTime stream_duration, gboolean no_signal)
{
GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (element);
GstClockTime timestamp;
@ -475,7 +475,7 @@ gst_decklink_audio_src_got_packet (GstElement * element,
GST_LOG_OBJECT (self,
"Got audio packet at %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT
", no signal %d", GST_TIME_ARGS (capture_time),
GST_TIME_ARGS (packet_time), no_signal);
GST_TIME_ARGS (stream_time), no_signal);
g_mutex_lock (&self->input->lock);
if (self->input->videosrc) {
@ -488,22 +488,22 @@ gst_decklink_audio_src_got_packet (GstElement * element,
}
if (videosrc->first_time == GST_CLOCK_TIME_NONE)
videosrc->first_time = packet_time;
videosrc->first_time = stream_time;
if (videosrc->skip_first_time > 0
&& packet_time - videosrc->first_time < videosrc->skip_first_time) {
&& stream_time - videosrc->first_time < videosrc->skip_first_time) {
GST_DEBUG_OBJECT (self,
"Skipping frame as requested: %" GST_TIME_FORMAT " < %"
GST_TIME_FORMAT, GST_TIME_ARGS (packet_time),
GST_TIME_FORMAT, GST_TIME_ARGS (stream_time),
GST_TIME_ARGS (videosrc->skip_first_time + videosrc->first_time));
g_mutex_unlock (&self->input->lock);
return;
}
if (videosrc->output_stream_time)
timestamp = packet_time;
timestamp = stream_time;
else
timestamp = gst_clock_adjust_with_calibration (NULL, packet_time,
timestamp = gst_clock_adjust_with_calibration (NULL, stream_time,
videosrc->current_time_mapping.xbase,
videosrc->current_time_mapping.b, videosrc->current_time_mapping.num,
videosrc->current_time_mapping.den);