Permalink
Browse files

DeckLink input adapter now outputs NULL frames if a frame is dropped

Note that this is likely to break applications!
  • Loading branch information...
1 parent 900a70d commit cde9a92dfe3e6cd1aff727372a7a327a04fc8e74 root committed Feb 14, 2013
Showing with 19 additions and 2 deletions.
  1. +5 −0 drivers/decklink.cpp
  2. +14 −2 replay/replay_ingest.cpp
View
@@ -741,6 +741,9 @@ class DeckLinkInputAdapter : public InputAdapter,
delete out;
}
}
+ } else {
+ fprintf(stderr, "DeckLink warning: frame with no video\n");
+ out_pipe.put(NULL);
}
/* Process audio, if available. */
@@ -758,6 +761,8 @@ class DeckLinkInputAdapter : public InputAdapter,
memcpy(audio_out->data( ), data, audio_out->size( ));
audio_pipe->put(audio_out);
+ } else if (audio_pipe != NULL) {
+ fprintf(stderr, "DeckLink warning: frame with no audio\n");
}
return S_OK;
View
@@ -41,7 +41,7 @@ void ReplayIngest::debug( ) {
}
void ReplayIngest::run_thread( ) {
- RawFrame *input, *thumb;
+ RawFrame *input, *thumb, *last_input;
AudioPacket *input_audio;
ReplayRawFrame *monitor_frame;
ReplayFrameData dest;
@@ -51,6 +51,8 @@ void ReplayIngest::run_thread( ) {
iadp->start( );
+ last_input = NULL;
+
for (;;) {
/* obtain frame (and maybe audio) from input adapter */
input = iadp->output_pipe( ).get( );
@@ -60,6 +62,12 @@ void ReplayIngest::run_thread( ) {
input_audio = NULL;
}
+ /* if a frame was dropped, use the last one */
+ if (input == NULL) {
+ fprintf(stderr, "ReplayIngest warning: video input returned a NULL frame\n");
+ input = last_input;
+ }
+
bool suspended;
{ MutexLock l(m);
@@ -112,7 +120,11 @@ void ReplayIngest::run_thread( ) {
delete input_audio;
}
- delete input;
+ /* if this frame was good, keep it */
+ if (input != last_input) {
+ delete last_input;
+ last_input = input;
+ }
}
}

0 comments on commit cde9a92

Please sign in to comment.