Skip to content

Commit

Permalink
Quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
naps62 committed Jul 30, 2020
1 parent 5e12554 commit 6f13243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ pub type ThreadSafeFrame = types::FrameMsg;

pub fn create(args: opts::Opts) -> Option<(thread::JoinHandle<()>, Sender<ThreadSafeFrame>)> {
if args.preview {
None
} else {
let (sender, receiver) = crossbeam_channel::unbounded();

let handle = thread::spawn(move || {
Expand All @@ -35,6 +33,8 @@ pub fn create(args: opts::Opts) -> Option<(thread::JoinHandle<()>, Sender<Thread
});

Some((handle, sender))
} else {
None
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ fn main() {
let canvas = canvas::create(args.clone());

loop {
// if preview is enabled, update it
if let Some((_, ref sender)) = canvas {
sender.send(pipeline.fil_as_msg()).unwrap();
}

// read a new frame from /dev/video0
decoder.decode_frame(pipeline.raw_ref());

Expand All @@ -37,5 +32,10 @@ fn main() {

// write the stuffed frame to /dev/video2
encoder.encode_frame(pipeline.yuv_ref());

// if preview is enabled, update it
if let Some((_, ref sender)) = canvas {
sender.send(pipeline.fil_as_msg()).unwrap();
}
}
}

0 comments on commit 6f13243

Please sign in to comment.