Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

public class Main {
    public static <T> T sureTake(BlockingQueue<T> audio) {
        while (true) {
            try {
                return audio.take();
            } catch (InterruptedException e) {
            }
        }
    }

    public static <T> T take(BlockingQueue<T> videoDrain, int ms) {
        try {
            return videoDrain.poll(ms, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            return null;
        }
    }
}