Skip to content

Conversation

@feerrenrut
Copy link
Contributor

The final remaining work stopping us from releasing the first beta is: #11520

This is holding back merging PR's into master that target 2020.4, I propose that we merge master into beta, and re-taraget #11520 to the beta branch.

This must be a merge commit (not squash merge)

JulienCochuyt and others added 30 commits August 13, 2019 09:57
Fixes #9910

Browseable messages, as produced with ui.browseableMessage are no longer shown in a tiny window, located near the top-left corner of the display, sometimes partially off-screen.
Fixes #9280

When debugging, it was a pain to delimit the relevant fragment of the log.

A global command has been added which marks the current end of the log as the start position of the fragment. When executed again, the fragment of the log is copied to the clipboard.
…io played for 10 seconds. (PR #11024)

Fixes #5172
Fixes #10721

## Summary of the issue:

- As described in #5172, some audio drivers/hardware take a long time to open the device and/or truncate the start/end of the audio.
- As described in #10721 (comment), calling WaveOutOpen in the OneCore synth callback mysteriously blocks (and thus lags) for ~100 ms. Because we close the audio device on idle, we can trigger this problem. Although #11023 mostly fixes this, it's impossible (or at least very difficult) to resolve this completely from within the OneCore driver.
- Aside from all of this, closing and opening the audio device for rapid short utterances (e.g. rapid movement with the cursor keys or typing) doesn't seem particularly optimal. It's difficult to measure this, but I'd say mitigating this is likely to make audio performance faster/smoother.

## Description of how this pull request fixes the issue:

When WavePlayer.idle() is called and closeWhenIdle is set, instead of closing the device immediately after the audio finishes, set a timer. If audio is played before the timer elapses, stop the timer. Close the device when the timer expires.
…the given script passing it this gesture, by using scriptHandler.executeScript. this is implemented to allow Gesture subclasses to perform actions before / after script execution. (#11478)

* scriptHandler._queueScriptCallback: call Gesture.executeScript rather than executeScript directly.
* keyboardHandler.KeyboardInputGesture: track the number of times this Gesture instance is sent as input onto the Operating System (I.e. how many times Gesture.send is called). this is recorded on a sendCount instance variable. This is useful to see if a script has actually sent its gesture on or not.
* keyboardHandler.KeyboardInputGesture: implement executeScript, which after executing the script normally, checks to see if the gesture was never actually sent, and that the gesture's modifiers could possibly perform an OS action (such as an input language change) and if so then sends key down and key up for the special VK_NONE key. This code was moved from internal_keyDownEvent. Having this code execute from the main thread as opposed to the keyboard hook, stops a deadlock with the ignoreInjection hook and stops deliberate reentrancy of the keyboard hook.
lukaszgo1 and others added 8 commits August 16, 2020 13:09
…collector, and remove several more reference cycles (#11499)

* Track deleting of important unreachable objects by the Python garbage collector. Includes COM pointers, and most NVDA-specific classes (AutoPropertyObject, _eventExecutor, WavePlayer, sayAll readers).

* ia2Web.Editor NVDAObject: clean up _lastCaretObj in event_loseFocus added by MozillaCompoundTextInfo, in order to break a reference cycle.

* logHandler: stop a reference cycle when fetching a frame's locals within an exception caluse where the Exception is exposed as a local variable within the clause.

* eventHandler: ensure that _eventExecutor does not end up as a reference cycle when there is an exception when executing an event.

* garbageHandler: add copyright header.

* Update What's new.

* Track some UpdateCheck classes with garbageHandler.
* ContentRecog: add a BaseContentRecogTextInfo class which all TextInfos emitted by RecogResult objects should now inherit from to avoid creating reference cycles. the built-in ContentRecognizer TextInfos now do this.

* Add comment
Fixes #5172
Fixes #10721
Fixes #11482
Fixes #11490

### History
#5172
Some audio drivers/hardware take a long time to open the device and/or truncate the start/end of the audio.

#10721
Calling WaveOutOpen in the OneCore synth callback mysteriously blocks (and thus lags) for ~100 ms. Because we close the audio device on idle, we can trigger this problem. Although PR #11023 mostly fixed this, it's impossible (or at least very difficult) to resolve this completely from within the OneCore driver.

PR #11024 attempted to fix these issues by waiting 10 seconds before closing the audio device"

### Problem to solve
Subsequent to #11024, there are occasional exceptions from nvwave, particularly when switching synthesisers. In particular the following cases need to be handled smoothly:
- When using Microsoft Sound Mapper, NVDA should use the Windows default device (even if it changes)
- When the NVDA configured devices becomes invalid, nvWave should fall back to Microsoft Sound Mapper
- When the NVDA configured device becomes available again, NVDA should switch back to using it.
- Handle no audio device at all.

Since these issues needed to be fixed, and also:
- Closing and opening the audio device was originally introduced to support Remote Desktop audio, this is now better served by other solutions. 
- Performance is improved by keeping it open, using a timeout means that the lag is more rare, but will still occur.

### How it is solved
Instead, now don't close the device at all. As per the discussion:
#11505 (comment)

To fix issues with current / preferred device:
- nvWave now saves the preferred device when it is constructed.
- If using a device fails, it is considered unavailable, nvWave attempts to fall back to "Microsoft Sound Mapper".
- From my testing, using "Microsoft Sound Mapper" correctly handled changing the default device (Win 10 2004). It would be helpful if others could confirm, especially on different OS versions.
- During `_idleUnbuffered`
  - The current device is checked to see if it matches the preferred device.
  - The available devices are polled to see if the preferred device is available, if so it switches.
* Add significant optional debug logging for MSAA events.

* Fix typo

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>

* Include winEvent params in log message.

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>

* Include winEvent params in log message.

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>

* Include window handle and windowClass name in log message about native UIA window.

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>

* Fix linting issues.

* * Included winEvent info to several more log calls.
* Added several more log calls.
* Improved log call for error in AccessibleObjectFromEvent and put it behind isMSAADebugLoggingEnabled.
* Fixed typo.
* Included threadID, processID and process name in winEvent log info where possible.

* Added yet more MSAA debug log messages.

* Fix typo

* Update what's new

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>
… cycle (#11552)

* GarbageHandler: ensure that objects due to logging (WavePlayer for example) don't get logged as an object being cleaned up by the garbage collector.
Specifically:
* change the first log.error to a log.warning (so the error sound does not play). Note that this message still must be logged as it is the one that contains the stack trace showing where the garbage collection is running.
* Increase the report count before logging any message in notifyOfObjectDeletion so that any objects deleted in the log calls themselves don't get tracked as the first  object to be deleted.
* Clear the garbage collection threadID in the gc hook before logging the final error, otherwise that error (and the error sound) is tracked as an object deletion.

* MozillaCompoundTextInfo: only cache lastCaretObj if the compoundTextInfo is on the current focus, otherwise the caretObj may not be cleaned up and a reference cycle may remain.
@AppVeyorBot
Copy link

See test results for failed build of commit 30f866d3eb

…f the winEvent limit has been exceeded for that thread (#11520)

* IAccessibleHandler: Still allow processing of winEvents for the currently focused object, even if the winEvent limit has been exceeded for that thread.

* IAccessibleHandler.OrderedWinEventLimitor.flushEvents: alwaysAllowedObjects is now optional.

* OrderedWinEventLimitor.flushEvents: counts of events per thread should still go up if the event is for the focus, even though we won't drop the event if we are over the limit.

* IAccessibleHandler: add typing information to OrderedWinEventLimitor.flushEvents and improve logic readability around skipping events due to exceeded count per thread.

* Tests for limit of events per thread

* OrderedWinEventLimiter: fix off-by-one error: 10 events per thread is emitted now, not 11.

* OrderedWinEventLimiter unit tests: remove work-arounds for off-by-one error for events per thread, and no longer expect certain failures

* Fix linting issue

* Update what's new

Co-authored-by: Reef Turner <reef@nvaccess.org>
@AppVeyorBot
Copy link

See test results for failed build of commit d2719fcc37

* NLS eReader is also known as NLS eReader Humanware

* Update what's new
@AppVeyorBot
Copy link

See test results for failed build of commit c53144c9ea

Merge pull request #11558 from nvaccess/beta
@AppVeyorBot
Copy link

See test results for failed build of commit 75e5011f55

@dpy013
Copy link
Contributor

dpy013 commented Sep 7, 2020

hello
@feerrenrut
Can you fix the flake8 error?
thanks

@feerrenrut feerrenrut merged commit 929b5f8 into beta Sep 8, 2020
@nvaccessAuto nvaccessAuto added this to the 2020.3 milestone Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.