< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 545,563 ****
monitoring = requiresServicing();
if (monitoring) {
getEventDispatcher().addLineMonitor(this);
}
doIO = true;
-
// need to set Active and Started
// note: the current API always requires that
// Started and Active are set at the same time...
if (isSource && stoppedWritten) {
setStarted(true);
setActive(true);
}
if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
}
@Override
--- 545,564 ----
monitoring = requiresServicing();
if (monitoring) {
getEventDispatcher().addLineMonitor(this);
}
+ synchronized(lock) {
doIO = true;
// need to set Active and Started
// note: the current API always requires that
// Started and Active are set at the same time...
if (isSource && stoppedWritten) {
setStarted(true);
setActive(true);
}
+ }
if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
}
@Override
*** 580,593 ****
synchronized(lock) {
// need to set doIO to false before notifying the
// read/write thread, that's why isStartedRunning()
// cannot be used
doIO = false;
- lock.notifyAll();
- }
setActive(false);
setStarted(false);
stoppedWritten = false;
if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
}
--- 581,594 ----
synchronized(lock) {
// need to set doIO to false before notifying the
// read/write thread, that's why isStartedRunning()
// cannot be used
doIO = false;
setActive(false);
setStarted(false);
+ lock.notifyAll();
+ }
stoppedWritten = false;
if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
}
*** 729,745 ****
throw new ArrayIndexOutOfBoundsException(off);
}
if ((long)off + (long)len > (long)b.length) {
throw new ArrayIndexOutOfBoundsException(b.length);
}
!
if (!isActive() && doIO) {
// this is not exactly correct... would be nicer
! // if the native sub system sent a callback when IO really starts
setActive(true);
setStarted(true);
}
int written = 0;
while (!flushing) {
int thisWritten;
synchronized (lockNative) {
thisWritten = nWrite(id, b, off, len,
--- 730,748 ----
throw new ArrayIndexOutOfBoundsException(off);
}
if ((long)off + (long)len > (long)b.length) {
throw new ArrayIndexOutOfBoundsException(b.length);
}
! synchronized(lock) {
if (!isActive() && doIO) {
// this is not exactly correct... would be nicer
! // if the native sub system sent a callback when IO really
! // starts
setActive(true);
setStarted(true);
}
+ }
int written = 0;
while (!flushing) {
int thisWritten;
synchronized (lockNative) {
thisWritten = nWrite(id, b, off, len,
*** 955,970 ****
throw new ArrayIndexOutOfBoundsException(off);
}
if ((long)off + (long)len > (long)b.length) {
throw new ArrayIndexOutOfBoundsException(b.length);
}
if (!isActive() && doIO) {
// this is not exactly correct... would be nicer
! // if the native sub system sent a callback when IO really starts
setActive(true);
setStarted(true);
}
int read = 0;
while (doIO && !flushing) {
int thisRead;
synchronized (lockNative) {
thisRead = nRead(id, b, off, len, softwareConversionSize);
--- 958,976 ----
throw new ArrayIndexOutOfBoundsException(off);
}
if ((long)off + (long)len > (long)b.length) {
throw new ArrayIndexOutOfBoundsException(b.length);
}
+ synchronized(lock) {
if (!isActive() && doIO) {
// this is not exactly correct... would be nicer
! // if the native sub system sent a callback when IO really
! // starts
setActive(true);
setStarted(true);
}
+ }
int read = 0;
while (doIO && !flushing) {
int thisRead;
synchronized (lockNative) {
thisRead = nRead(id, b, off, len, softwareConversionSize);
< prev index next >