summaryrefslogtreecommitdiff
path: root/chromium/media
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-15 14:18:00 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-15 14:00:37 +0000
commit66a2147d838e293f4a5db7711c8eba4e6faaaf0f (patch)
tree61ad99912355f5b6cc603d9b1dfadd77b950ce98 /chromium/media
parentda51f56cc21233c2d30f0fe0d171727c3102b2e0 (diff)
downloadqtwebengine-chromium-66a2147d838e293f4a5db7711c8eba4e6faaaf0f.tar.gz
BASELINE: Update Chromium to 65.0.3325.75
Change-Id: I5485bc5c111539356276457516584fa5737f07d8 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/media')
-rw-r--r--chromium/media/audio/mac/audio_low_latency_input_mac.cc423
-rw-r--r--chromium/media/audio/mac/audio_low_latency_input_mac.h49
-rw-r--r--chromium/media/audio/win/audio_low_latency_output_win.cc29
-rw-r--r--chromium/media/audio/win/core_audio_util_win.cc25
-rw-r--r--chromium/media/capture/video/chromeos/local_gpu_memory_buffer_manager.cc9
-rw-r--r--chromium/media/capture/video/chromeos/mock_gpu_memory_buffer_manager.cc4
-rw-r--r--chromium/media/capture/video/chromeos/stream_buffer_manager_unittest.cc4
-rw-r--r--chromium/media/gpu/v4l2/generic_v4l2_device.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc22
9 files changed, 59 insertions, 508 deletions
diff --git a/chromium/media/audio/mac/audio_low_latency_input_mac.cc b/chromium/media/audio/mac/audio_low_latency_input_mac.cc
index bb09aaeec2a..9dd6d9ad2db 100644
--- a/chromium/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/chromium/media/audio/mac/audio_low_latency_input_mac.cc
@@ -70,91 +70,6 @@ static std::ostream& operator<<(std::ostream& os,
return os;
}
-// Property address to monitor device changes. Use wildcards to match any and
-// all values for their associated type. Filtering for device-specific
-// notifications will take place in the callback.
-const AudioObjectPropertyAddress
- AUAudioInputStream::kDeviceChangePropertyAddress = {
- kAudioObjectPropertySelectorWildcard, kAudioObjectPropertyScopeWildcard,
- kAudioObjectPropertyElementWildcard};
-
-// Maps internal enumerator values (e.g. kAudioDevicePropertyDeviceHasChanged)
-// into local values that are suitable for UMA stats.
-// See AudioObjectPropertySelector in CoreAudio/AudioHardware.h for details.
-// TODO(henrika): ensure that the "other" bucket contains as few counts as
-// possible by adding more valid enumerators below.
-enum AudioDevicePropertyResult {
- PROPERTY_OTHER = 0, // Use for all non-supported property changes
- PROPERTY_DEVICE_HAS_CHANGED = 1,
- PROPERTY_IO_STOPPED_ABNORMALLY = 2,
- PROPERTY_HOG_MODE = 3,
- PROPERTY_BUFFER_FRAME_SIZE = 4,
- PROPERTY_BUFFER_FRAME_SIZE_RANGE = 5,
- PROPERTY_STREAM_CONFIGURATION = 6,
- PROPERTY_ACTUAL_SAMPLE_RATE = 7,
- PROPERTY_NOMINAL_SAMPLE_RATE = 8,
- PROPERTY_DEVICE_IS_RUNNING_SOMEWHERE = 9,
- PROPERTY_DEVICE_IS_RUNNING = 10,
- PROPERTY_DEVICE_IS_ALIVE = 11,
- PROPERTY_STREAM_PHYSICAL_FORMAT = 12,
- PROPERTY_JACK_IS_CONNECTED = 13,
- PROPERTY_PROCESSOR_OVERLOAD = 14,
- PROPERTY_DATA_SOURCES = 15,
- PROPERTY_DATA_SOURCE = 16,
- PROPERTY_VOLUME_DECIBELS = 17,
- PROPERTY_VOLUME_SCALAR = 18,
- PROPERTY_MUTE = 19,
- PROPERTY_PLUGIN = 20,
- PROPERTY_USES_VARIABLE_BUFFER_FRAME_SIZES = 21,
- PROPERTY_IO_CYCLE_USAGE = 22,
- PROPERTY_IO_PROC_STREAM_USAGE = 23,
- PROPERTY_CONFIGURATION_APPLICATION = 24,
- PROPERTY_DEVICE_UID = 25,
- PROPERTY_MODE_UID = 26,
- PROPERTY_TRANSPORT_TYPE = 27,
- PROPERTY_RELATED_DEVICES = 28,
- PROPERTY_CLOCK_DOMAIN = 29,
- PROPERTY_DEVICE_CAN_BE_DEFAULT_DEVICE = 30,
- PROPERTY_DEVICE_CAN_BE_DEFAULT_SYSTEM_DEVICE = 31,
- PROPERTY_LATENCY = 32,
- PROPERTY_STREAMS = 33,
- PROPERTY_CONTROL_LIST = 34,
- PROPERTY_SAFETY_OFFSET = 35,
- PROPERTY_AVAILABLE_NOMINAL_SAMPLE_RATES = 36,
- PROPERTY_ICON = 37,
- PROPERTY_IS_HIDDEN = 38,
- PROPERTY_PREFERRED_CHANNELS_FOR_STEREO = 39,
- PROPERTY_PREFERRED_CHANNEL_LAYOUT = 40,
- PROPERTY_VOLUME_RANGE_DECIBELS = 41,
- PROPERTY_VOLUME_SCALAR_TO_DECIBELS = 42,
- PROPERTY_VOLUME_DECIBEL_TO_SCALAR = 43,
- PROPERTY_STEREO_PAN = 44,
- PROPERTY_STEREO_PAN_CHANNELS = 45,
- PROPERTY_SOLO = 46,
- PROPERTY_PHANTOM_POWER = 47,
- PROPERTY_PHASE_INVERT = 48,
- PROPERTY_CLIP_LIGHT = 49,
- PROPERTY_TALKBACK = 50,
- PROPERTY_LISTENBACK = 51,
- PROPERTY_CLOCK_SOURCE = 52,
- PROPERTY_CLOCK_SOURCES = 53,
- PROPERTY_SUB_MUTE = 54,
- PROPERTY_MAX = PROPERTY_SUB_MUTE
-};
-
-// Add the provided value in |result| to a UMA histogram.
-static void LogDevicePropertyChange(bool startup_failed,
- AudioDevicePropertyResult result) {
- if (startup_failed) {
- UMA_HISTOGRAM_ENUMERATION(
- "Media.Audio.InputDevicePropertyChangedStartupFailedMac", result,
- PROPERTY_MAX + 1);
- } else {
- UMA_HISTOGRAM_ENUMERATION("Media.Audio.InputDevicePropertyChangedMac",
- result, PROPERTY_MAX + 1);
- }
-}
-
static OSStatus GetInputDeviceStreamFormat(
AudioUnit audio_unit,
AudioStreamBasicDescription* format) {
@@ -239,15 +154,13 @@ AUAudioInputStream::AUAudioInputStream(
start_was_deferred_(false),
buffer_size_was_changed_(false),
audio_unit_render_has_worked_(false),
- device_listener_is_active_(false),
noise_reduction_suppressed_(false),
last_sample_time_(0.0),
last_number_of_frames_(0),
total_lost_frames_(0),
largest_glitch_frames_(0),
glitches_detected_(0),
- log_callback_(log_callback),
- weak_factory_(this) {
+ log_callback_(log_callback) {
DCHECK(manager_);
CHECK(!log_callback_.Equals(AudioManager::LogCallback()));
@@ -291,7 +204,6 @@ AUAudioInputStream::AUAudioInputStream(
AUAudioInputStream::~AUAudioInputStream() {
DVLOG(1) << "~dtor";
- DCHECK(!device_listener_is_active_);
ReportAndResetStats();
}
@@ -309,9 +221,6 @@ bool AUAudioInputStream::Open() {
return false;
}
- // Start listening for changes in device properties.
- RegisterDeviceChangeListener();
-
// The requested sample-rate must match the hardware sample-rate.
int sample_rate =
AudioManagerMac::HardwareSampleRateForDevice(input_device_id_);
@@ -605,16 +514,9 @@ void AUAudioInputStream::Close() {
// Uninitialize and dispose the audio unit.
CloseAudioUnit();
- // Disable the listener for device property changes.
- DeRegisterDeviceChangeListener();
-
// Add more UMA stats but only if AGC was activated, i.e. for e.g. WebRTC
// audio input streams.
if (GetAutomaticGainControl()) {
- // Check if any device property changes are added by filtering out a
- // selected set of the |device_property_changes_map_| map. Add UMA stats
- // if valuable data is found.
- AddDevicePropertyChangesToUMA(false);
// Log whether call to Start() was deferred or not. To be compared with
// Media.Audio.InputStartWasDeferredMac which logs the same value but only
// when input audio fails to start.
@@ -974,82 +876,6 @@ OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames,
return noErr;
}
-void AUAudioInputStream::DevicePropertyChangedOnMainThread(
- const std::vector<UInt32>& properties) {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(device_listener_is_active_);
- // Use property as key to a map and increase its value. We are not
- // interested in all property changes but store all here anyhow.
- // Filtering will be done later in AddDevicePropertyChangesToUMA();
- for (auto property : properties) {
- DVLOG(2) << "=> " << FourCharFormatCodeToString(property);
- ++device_property_changes_map_[property];
- }
-}
-
-OSStatus AUAudioInputStream::OnDevicePropertyChanged(
- AudioObjectID object_id,
- UInt32 num_addresses,
- const AudioObjectPropertyAddress addresses[],
- void* context) {
- AUAudioInputStream* self = static_cast<AUAudioInputStream*>(context);
- return self->DevicePropertyChanged(object_id, num_addresses, addresses);
-}
-
-OSStatus AUAudioInputStream::DevicePropertyChanged(
- AudioObjectID object_id,
- UInt32 num_addresses,
- const AudioObjectPropertyAddress addresses[]) {
- if (object_id != input_device_id_)
- return noErr;
-
- // Listeners will be called when possibly many properties have changed.
- // Consequently, the implementation of a listener must go through the array of
- // addresses to see what exactly has changed. Copy values into a local vector
- // and update the |device_property_changes_map_| on the main thread to avoid
- // potential race conditions.
- std::vector<UInt32> properties;
- properties.reserve(num_addresses);
- for (UInt32 i = 0; i < num_addresses; ++i) {
- properties.push_back(addresses[i].mSelector);
- }
- manager_->GetTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&AUAudioInputStream::DevicePropertyChangedOnMainThread,
- weak_factory_.GetWeakPtr(), properties));
- return noErr;
-}
-
-void AUAudioInputStream::RegisterDeviceChangeListener() {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!device_listener_is_active_);
- DVLOG(1) << "RegisterDeviceChangeListener";
- if (input_device_id_ == kAudioObjectUnknown)
- return;
- device_property_changes_map_.clear();
- OSStatus result = AudioObjectAddPropertyListener(
- input_device_id_, &kDeviceChangePropertyAddress,
- &AUAudioInputStream::OnDevicePropertyChanged, this);
- OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
- << "AudioObjectAddPropertyListener() failed!";
- device_listener_is_active_ = (result == noErr);
-}
-
-void AUAudioInputStream::DeRegisterDeviceChangeListener() {
- DCHECK(thread_checker_.CalledOnValidThread());
- if (!device_listener_is_active_)
- return;
- DVLOG(1) << "DeRegisterDeviceChangeListener";
- if (input_device_id_ == kAudioObjectUnknown)
- return;
- device_listener_is_active_ = false;
- OSStatus result = AudioObjectRemovePropertyListener(
- input_device_id_, &kDeviceChangePropertyAddress,
- &AUAudioInputStream::OnDevicePropertyChanged, this);
- OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
- << "AudioObjectRemovePropertyListener() failed!";
-}
-
int AUAudioInputStream::HardwareSampleRate() {
// Determine the default input device's sample-rate.
AudioDeviceID device_id = kAudioObjectUnknown;
@@ -1219,259 +1045,12 @@ void AUAudioInputStream::AddHistogramsForFailedStartup() {
// be fixed when we understand the problem better.
UMA_HISTOGRAM_BOOLEAN("Media.Audio.AutomaticGainControlMac",
GetAutomaticGainControl());
- // Disable the listener for device property changes. Ensures that we don't
- // need a lock when reading the map.
- DeRegisterDeviceChangeListener();
- // Check if any device property changes are added by filtering out a selected
- // set of the |device_property_changes_map_| map. Add UMA stats if valuable
- // data is found.
- AddDevicePropertyChangesToUMA(true);
// Add information about things like number of logical processors, number
// of system resume events etc.
AddSystemInfoToUMA(manager_->IsOnBatteryPower(),
manager_->GetNumberOfResumeNotifications());
}
-void AUAudioInputStream::AddDevicePropertyChangesToUMA(bool startup_failed) {
- DVLOG(1) << "AddDevicePropertyChangesToUMA";
- DCHECK(!device_listener_is_active_);
- // Scan the map of all available property changes (notification types) and
- // filter out some that make sense to add to UMA stats.
- // TODO(henrika): figure out if the set of stats is sufficient or not.
- for (const auto& entry : device_property_changes_map_) {
- UInt32 device_property = entry.first;
- int change_count = entry.second;
- AudioDevicePropertyResult uma_result = PROPERTY_OTHER;
- switch (device_property) {
- case kAudioDevicePropertyDeviceHasChanged:
- uma_result = PROPERTY_DEVICE_HAS_CHANGED;
- DVLOG(1) << "kAudioDevicePropertyDeviceHasChanged";
- break;
- case kAudioDevicePropertyIOStoppedAbnormally:
- uma_result = PROPERTY_IO_STOPPED_ABNORMALLY;
- DVLOG(1) << "kAudioDevicePropertyIOStoppedAbnormally";
- break;
- case kAudioDevicePropertyHogMode:
- uma_result = PROPERTY_HOG_MODE;
- DVLOG(1) << "kAudioDevicePropertyHogMode";
- break;
- case kAudioDevicePropertyBufferFrameSize:
- uma_result = PROPERTY_BUFFER_FRAME_SIZE;
- DVLOG(1) << "kAudioDevicePropertyBufferFrameSize";
- break;
- case kAudioDevicePropertyBufferFrameSizeRange:
- uma_result = PROPERTY_BUFFER_FRAME_SIZE_RANGE;
- DVLOG(1) << "kAudioDevicePropertyBufferFrameSizeRange";
- break;
- case kAudioDevicePropertyStreamConfiguration:
- uma_result = PROPERTY_STREAM_CONFIGURATION;
- DVLOG(1) << "kAudioDevicePropertyStreamConfiguration";
- break;
- case kAudioDevicePropertyActualSampleRate:
- uma_result = PROPERTY_ACTUAL_SAMPLE_RATE;
- DVLOG(1) << "kAudioDevicePropertyActualSampleRate";
- break;
- case kAudioDevicePropertyNominalSampleRate:
- uma_result = PROPERTY_NOMINAL_SAMPLE_RATE;
- DVLOG(1) << "kAudioDevicePropertyNominalSampleRate";
- break;
- case kAudioDevicePropertyDeviceIsRunningSomewhere:
- uma_result = PROPERTY_DEVICE_IS_RUNNING_SOMEWHERE;
- DVLOG(1) << "kAudioDevicePropertyDeviceIsRunningSomewhere";
- break;
- case kAudioDevicePropertyDeviceIsRunning:
- uma_result = PROPERTY_DEVICE_IS_RUNNING;
- DVLOG(1) << "kAudioDevicePropertyDeviceIsRunning";
- break;
- case kAudioDevicePropertyDeviceIsAlive:
- uma_result = PROPERTY_DEVICE_IS_ALIVE;
- DVLOG(1) << "kAudioDevicePropertyDeviceIsAlive";
- break;
- case kAudioStreamPropertyPhysicalFormat:
- uma_result = PROPERTY_STREAM_PHYSICAL_FORMAT;
- DVLOG(1) << "kAudioStreamPropertyPhysicalFormat";
- break;
- case kAudioDevicePropertyJackIsConnected:
- uma_result = PROPERTY_JACK_IS_CONNECTED;
- DVLOG(1) << "kAudioDevicePropertyJackIsConnected";
- break;
- case kAudioDeviceProcessorOverload:
- uma_result = PROPERTY_PROCESSOR_OVERLOAD;
- DVLOG(1) << "kAudioDeviceProcessorOverload";
- break;
- case kAudioDevicePropertyDataSources:
- uma_result = PROPERTY_DATA_SOURCES;
- DVLOG(1) << "kAudioDevicePropertyDataSources";
- break;
- case kAudioDevicePropertyDataSource:
- uma_result = PROPERTY_DATA_SOURCE;
- DVLOG(1) << "kAudioDevicePropertyDataSource";
- break;
- case kAudioDevicePropertyVolumeDecibels:
- uma_result = PROPERTY_VOLUME_DECIBELS;
- DVLOG(1) << "kAudioDevicePropertyVolumeDecibels";
- break;
- case kAudioDevicePropertyVolumeScalar:
- uma_result = PROPERTY_VOLUME_SCALAR;
- DVLOG(1) << "kAudioDevicePropertyVolumeScalar";
- break;
- case kAudioDevicePropertyMute:
- uma_result = PROPERTY_MUTE;
- DVLOG(1) << "kAudioDevicePropertyMute";
- break;
- case kAudioDevicePropertyPlugIn:
- uma_result = PROPERTY_PLUGIN;
- DVLOG(1) << "kAudioDevicePropertyPlugIn";
- break;
- case kAudioDevicePropertyUsesVariableBufferFrameSizes:
- uma_result = PROPERTY_USES_VARIABLE_BUFFER_FRAME_SIZES;
- DVLOG(1) << "kAudioDevicePropertyUsesVariableBufferFrameSizes";
- break;
- case kAudioDevicePropertyIOCycleUsage:
- uma_result = PROPERTY_IO_CYCLE_USAGE;
- DVLOG(1) << "kAudioDevicePropertyIOCycleUsage";
- break;
- case kAudioDevicePropertyIOProcStreamUsage:
- uma_result = PROPERTY_IO_PROC_STREAM_USAGE;
- DVLOG(1) << "kAudioDevicePropertyIOProcStreamUsage";
- break;
- case kAudioDevicePropertyConfigurationApplication:
- uma_result = PROPERTY_CONFIGURATION_APPLICATION;
- DVLOG(1) << "kAudioDevicePropertyConfigurationApplication";
- break;
- case kAudioDevicePropertyDeviceUID:
- uma_result = PROPERTY_DEVICE_UID;
- DVLOG(1) << "kAudioDevicePropertyDeviceUID";
- break;
- case kAudioDevicePropertyModelUID:
- uma_result = PROPERTY_MODE_UID;
- DVLOG(1) << "kAudioDevicePropertyModelUID";
- break;
- case kAudioDevicePropertyTransportType:
- uma_result = PROPERTY_TRANSPORT_TYPE;
- DVLOG(1) << "kAudioDevicePropertyTransportType";
- break;
- case kAudioDevicePropertyRelatedDevices:
- uma_result = PROPERTY_RELATED_DEVICES;
- DVLOG(1) << "kAudioDevicePropertyRelatedDevices";
- break;
- case kAudioDevicePropertyClockDomain:
- uma_result = PROPERTY_CLOCK_DOMAIN;
- DVLOG(1) << "kAudioDevicePropertyClockDomain";
- break;
- case kAudioDevicePropertyDeviceCanBeDefaultDevice:
- uma_result = PROPERTY_DEVICE_CAN_BE_DEFAULT_DEVICE;
- DVLOG(1) << "kAudioDevicePropertyDeviceCanBeDefaultDevice";
- break;
- case kAudioDevicePropertyDeviceCanBeDefaultSystemDevice:
- uma_result = PROPERTY_DEVICE_CAN_BE_DEFAULT_SYSTEM_DEVICE;
- DVLOG(1) << "kAudioDevicePropertyDeviceCanBeDefaultSystemDevice";
- break;
- case kAudioDevicePropertyLatency:
- uma_result = PROPERTY_LATENCY;
- DVLOG(1) << "kAudioDevicePropertyLatency";
- break;
- case kAudioDevicePropertyStreams:
- uma_result = PROPERTY_STREAMS;
- DVLOG(1) << "kAudioDevicePropertyStreams";
- break;
- case kAudioObjectPropertyControlList:
- uma_result = PROPERTY_CONTROL_LIST;
- DVLOG(1) << "kAudioObjectPropertyControlList";
- break;
- case kAudioDevicePropertySafetyOffset:
- uma_result = PROPERTY_SAFETY_OFFSET;
- DVLOG(1) << "kAudioDevicePropertySafetyOffset";
- break;
- case kAudioDevicePropertyAvailableNominalSampleRates:
- uma_result = PROPERTY_AVAILABLE_NOMINAL_SAMPLE_RATES;
- DVLOG(1) << "kAudioDevicePropertyAvailableNominalSampleRates";
- break;
- case kAudioDevicePropertyIcon:
- uma_result = PROPERTY_ICON;
- DVLOG(1) << "kAudioDevicePropertyIcon";
- break;
- case kAudioDevicePropertyIsHidden:
- uma_result = PROPERTY_IS_HIDDEN;
- DVLOG(1) << "kAudioDevicePropertyIsHidden";
- break;
- case kAudioDevicePropertyPreferredChannelsForStereo:
- uma_result = PROPERTY_PREFERRED_CHANNELS_FOR_STEREO;
- DVLOG(1) << "kAudioDevicePropertyPreferredChannelsForStereo";
- break;
- case kAudioDevicePropertyPreferredChannelLayout:
- uma_result = PROPERTY_PREFERRED_CHANNEL_LAYOUT;
- DVLOG(1) << "kAudioDevicePropertyPreferredChannelLayout";
- break;
- case kAudioDevicePropertyVolumeRangeDecibels:
- uma_result = PROPERTY_VOLUME_RANGE_DECIBELS;
- DVLOG(1) << "kAudioDevicePropertyVolumeRangeDecibels";
- break;
- case kAudioDevicePropertyVolumeScalarToDecibels:
- uma_result = PROPERTY_VOLUME_SCALAR_TO_DECIBELS;
- DVLOG(1) << "kAudioDevicePropertyVolumeScalarToDecibels";
- break;
- case kAudioDevicePropertyVolumeDecibelsToScalar:
- uma_result = PROPERTY_VOLUME_DECIBEL_TO_SCALAR;
- DVLOG(1) << "kAudioDevicePropertyVolumeDecibelsToScalar";
- break;
- case kAudioDevicePropertyStereoPan:
- uma_result = PROPERTY_STEREO_PAN;
- DVLOG(1) << "kAudioDevicePropertyStereoPan";
- break;
- case kAudioDevicePropertyStereoPanChannels:
- uma_result = PROPERTY_STEREO_PAN_CHANNELS;
- DVLOG(1) << "kAudioDevicePropertyStereoPanChannels";
- break;
- case kAudioDevicePropertySolo:
- uma_result = PROPERTY_SOLO;
- DVLOG(1) << "kAudioDevicePropertySolo";
- break;
- case kAudioDevicePropertyPhantomPower:
- uma_result = PROPERTY_PHANTOM_POWER;
- DVLOG(1) << "kAudioDevicePropertyPhantomPower";
- break;
- case kAudioDevicePropertyPhaseInvert:
- uma_result = PROPERTY_PHASE_INVERT;
- DVLOG(1) << "kAudioDevicePropertyPhaseInvert";
- break;
- case kAudioDevicePropertyClipLight:
- uma_result = PROPERTY_CLIP_LIGHT;
- DVLOG(1) << "kAudioDevicePropertyClipLight";
- break;
- case kAudioDevicePropertyTalkback:
- uma_result = PROPERTY_TALKBACK;
- DVLOG(1) << "kAudioDevicePropertyTalkback";
- break;
- case kAudioDevicePropertyListenback:
- uma_result = PROPERTY_LISTENBACK;
- DVLOG(1) << "kAudioDevicePropertyListenback";
- break;
- case kAudioDevicePropertyClockSource:
- uma_result = PROPERTY_CLOCK_SOURCE;
- DVLOG(1) << "kAudioDevicePropertyClockSource";
- break;
- case kAudioDevicePropertyClockSources:
- uma_result = PROPERTY_CLOCK_SOURCES;
- DVLOG(1) << "kAudioDevicePropertyClockSources";
- break;
- case kAudioDevicePropertySubMute:
- uma_result = PROPERTY_SUB_MUTE;
- DVLOG(1) << "kAudioDevicePropertySubMute";
- break;
- default:
- uma_result = PROPERTY_OTHER;
- DVLOG(1) << "Property change is ignored";
- break;
- }
- DVLOG(1) << "property: " << device_property << " ("
- << FourCharFormatCodeToString(device_property) << ")"
- << " changed: " << change_count;
- LogDevicePropertyChange(startup_failed, uma_result);
- }
- device_property_changes_map_.clear();
-}
-
void AUAudioInputStream::UpdateCaptureTimestamp(
const AudioTimeStamp* timestamp) {
if ((timestamp->mFlags & kAudioTimeStampSampleTimeValid) == 0)
diff --git a/chromium/media/audio/mac/audio_low_latency_input_mac.h b/chromium/media/audio/mac/audio_low_latency_input_mac.h
index 0c2acfaa2da..1e51116b8e1 100644
--- a/chromium/media/audio/mac/audio_low_latency_input_mac.h
+++ b/chromium/media/audio/mac/audio_low_latency_input_mac.h
@@ -39,14 +39,12 @@
#include <AudioUnit/AudioUnit.h>
#include <CoreAudio/CoreAudio.h>
-#include <map>
#include <memory>
#include <vector>
#include "base/atomicops.h"
#include "base/cancelable_callback.h"
#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -97,8 +95,6 @@ class MEDIA_EXPORT AUAudioInputStream
}
private:
- static const AudioObjectPropertyAddress kDeviceChangePropertyAddress;
-
// Callback functions called on a real-time priority I/O thread from the audio
// unit. These methods are called when recorded audio is available.
static OSStatus DataIsAvailable(void* context,
@@ -117,27 +113,6 @@ class MEDIA_EXPORT AUAudioInputStream
AudioBufferList* io_data,
const AudioTimeStamp* time_stamp);
- // Callback functions called on different system threads from the Core Audio
- // framework. These methods are called when device properties are changed.
- static OSStatus OnDevicePropertyChanged(
- AudioObjectID object_id,
- UInt32 num_addresses,
- const AudioObjectPropertyAddress addresses[],
- void* context);
- OSStatus DevicePropertyChanged(AudioObjectID object_id,
- UInt32 num_addresses,
- const AudioObjectPropertyAddress addresses[]);
-
- // Updates the |device_property_changes_map_| on the main browser thread,
- // (CrBrowserMain) which is the same thread as this instance is created on.
- void DevicePropertyChangedOnMainThread(const std::vector<UInt32>& properties);
-
- // Registers OnDevicePropertyChanged() to receive notifications when device
- // properties changes.
- void RegisterDeviceChangeListener();
- // Stop listening for changes in device properties.
- void DeRegisterDeviceChangeListener();
-
// Gets the current capture time.
base::TimeTicks GetCaptureTime(const AudioTimeStamp* input_time_stamp);
@@ -166,10 +141,6 @@ class MEDIA_EXPORT AUAudioInputStream
// Adds extra UMA stats when it has been detected that startup failed.
void AddHistogramsForFailedStartup();
- // Scans the map of all available property changes (notification types) and
- // filters out some that make sense to add to UMA stats.
- void AddDevicePropertyChangesToUMA(bool startup_failed);
-
// Updates capture timestamp, current lost frames, and total lost frames and
// glitches.
void UpdateCaptureTimestamp(const AudioTimeStamp* timestamp);
@@ -263,21 +234,6 @@ class MEDIA_EXPORT AUAudioInputStream
// Set to true once when AudioUnitRender() succeeds for the first time.
bool audio_unit_render_has_worked_;
- // Maps unique representations of device property notification types and
- // number of times we have been notified about a change in such a type.
- // While the notifier is active, this member is modified by several different
- // internal thread. My guess is that a serial dispatch queue is used under
- // the hood and it executes one task at a time in the order in which they are
- // added to the queue. The currently executing task runs on a distinct thread
- // (which can vary from task to task) that is managed by the dispatch queue.
- // The map is always read on the creating thread but only while the notifier
- // is disabled, hence no lock is required.
- std::map<UInt32, int> device_property_changes_map_;
-
- // Set to true when we are listening for changes in device properties.
- // Only touched on the creating thread.
- bool device_listener_is_active_;
-
// Set to true when we've successfully called SuppressNoiseReduction to
// disable ambient noise reduction.
bool noise_reduction_suppressed_;
@@ -299,11 +255,6 @@ class MEDIA_EXPORT AUAudioInputStream
// Callback to send statistics info.
AudioManager::LogCallback log_callback_;
- // Used to ensure DevicePropertyChangedOnMainThread() is not called when
- // this object is destroyed.
- // Note that, all member variables should appear before the WeakPtrFactory.
- base::WeakPtrFactory<AUAudioInputStream> weak_factory_;
-
DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream);
};
diff --git a/chromium/media/audio/win/audio_low_latency_output_win.cc b/chromium/media/audio/win/audio_low_latency_output_win.cc
index 1a538d02b98..accbacb4aa0 100644
--- a/chromium/media/audio/win/audio_low_latency_output_win.cc
+++ b/chromium/media/audio/win/audio_low_latency_output_win.cc
@@ -251,17 +251,34 @@ void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) {
return;
}
- source_ = callback;
-
- // Ensure that the endpoint buffer is prepared with silence.
+ // Ensure that the endpoint buffer is prepared with silence. Also serves as
+ // a sanity check for the IAudioClient and IAudioRenderClient which may have
+ // been invalidated by Windows since the last Stop() call.
+ //
+ // While technically we only need to retry when WASAPI tells us the device has
+ // been invalidated (AUDCLNT_E_DEVICE_INVALIDATED), we retry for all errors
+ // for simplicity and due to large sites like YouTube reporting high success
+ // rates with a simple retry upon detection of an audio output error.
if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) {
if (!CoreAudioUtil::FillRenderEndpointBufferWithSilence(
audio_client_.Get(), audio_render_client_.Get())) {
- LOG(ERROR) << "Failed to prepare endpoint buffers with silence.";
- callback->OnError();
- return;
+ DLOG(WARNING) << "Failed to prepare endpoint buffers with silence. "
+ "Attempting recovery with a new IAudioClient and "
+ "IAudioRenderClient.";
+
+ opened_ = false;
+ audio_client_.Reset();
+ audio_render_client_.Reset();
+ if (!Open() || !CoreAudioUtil::FillRenderEndpointBufferWithSilence(
+ audio_client_.Get(), audio_render_client_.Get())) {
+ DLOG(ERROR) << "Failed recovery of audio clients; Start() failed.";
+ callback->OnError();
+ return;
+ }
}
}
+
+ source_ = callback;
num_written_frames_ = endpoint_buffer_size_frames_;
// Create and start the thread that will drive the rendering by waiting for
diff --git a/chromium/media/audio/win/core_audio_util_win.cc b/chromium/media/audio/win/core_audio_util_win.cc
index 36dd9cd9aef..d8a20c84833 100644
--- a/chromium/media/audio/win/core_audio_util_win.cc
+++ b/chromium/media/audio/win/core_audio_util_win.cc
@@ -897,25 +897,36 @@ ComPtr<IAudioCaptureClient> CoreAudioUtil::CreateCaptureClient(
}
bool CoreAudioUtil::FillRenderEndpointBufferWithSilence(
- IAudioClient* client, IAudioRenderClient* render_client) {
+ IAudioClient* client,
+ IAudioRenderClient* render_client) {
UINT32 endpoint_buffer_size = 0;
- if (FAILED(client->GetBufferSize(&endpoint_buffer_size)))
+ if (FAILED(client->GetBufferSize(&endpoint_buffer_size))) {
+ PLOG(ERROR) << "Failed IAudioClient::GetBufferSize()";
return false;
+ }
UINT32 num_queued_frames = 0;
- if (FAILED(client->GetCurrentPadding(&num_queued_frames)))
+ if (FAILED(client->GetCurrentPadding(&num_queued_frames))) {
+ PLOG(ERROR) << "Failed IAudioClient::GetCurrentPadding()";
return false;
+ }
BYTE* data = NULL;
int num_frames_to_fill = endpoint_buffer_size - num_queued_frames;
- if (FAILED(render_client->GetBuffer(num_frames_to_fill, &data)))
+ if (FAILED(render_client->GetBuffer(num_frames_to_fill, &data))) {
+ PLOG(ERROR) << "Failed IAudioRenderClient::GetBuffer()";
return false;
+ }
// Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to
// explicitly write silence data to the rendering buffer.
- DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence";
- return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill,
- AUDCLNT_BUFFERFLAGS_SILENT));
+ if (FAILED(render_client->ReleaseBuffer(num_frames_to_fill,
+ AUDCLNT_BUFFERFLAGS_SILENT))) {
+ PLOG(ERROR) << "Failed IAudioRenderClient::ReleaseBuffer()";
+ return false;
+ }
+
+ return true;
}
bool CoreAudioUtil::GetDxDiagDetails(std::string* driver_name,
diff --git a/chromium/media/capture/video/chromeos/local_gpu_memory_buffer_manager.cc b/chromium/media/capture/video/chromeos/local_gpu_memory_buffer_manager.cc
index 7c213cb49b3..2396d59c7d3 100644
--- a/chromium/media/capture/video/chromeos/local_gpu_memory_buffer_manager.cc
+++ b/chromium/media/capture/video/chromeos/local_gpu_memory_buffer_manager.cc
@@ -69,11 +69,10 @@ class GpuMemoryBufferImplGbm : public gfx::GpuMemoryBuffer {
handle_.native_pixmap_handle.fds.push_back(
base::FileDescriptor(gbm_bo_get_fd(buffer_object), false));
for (size_t i = 0; i < gbm_bo_get_num_planes(buffer_object); ++i) {
- handle_.native_pixmap_handle.planes.push_back(gfx::NativePixmapPlane(
- gbm_bo_get_plane_stride(buffer_object, i),
- gbm_bo_get_plane_offset(buffer_object, i),
- gbm_bo_get_plane_size(buffer_object, i),
- gbm_bo_get_plane_format_modifier(buffer_object, i)));
+ handle_.native_pixmap_handle.planes.push_back(
+ gfx::NativePixmapPlane(gbm_bo_get_plane_stride(buffer_object, i),
+ gbm_bo_get_plane_offset(buffer_object, i),
+ gbm_bo_get_plane_size(buffer_object, i)));
}
}
diff --git a/chromium/media/capture/video/chromeos/mock_gpu_memory_buffer_manager.cc b/chromium/media/capture/video/chromeos/mock_gpu_memory_buffer_manager.cc
index 529f9da2ab6..9a45b69f3ce 100644
--- a/chromium/media/capture/video/chromeos/mock_gpu_memory_buffer_manager.cc
+++ b/chromium/media/capture/video/chromeos/mock_gpu_memory_buffer_manager.cc
@@ -35,10 +35,10 @@ MockGpuMemoryBufferManager::ReturnValidBuffer(
// Set a dummy fd since this is for testing only.
handle.native_pixmap_handle.fds.push_back(base::FileDescriptor(0, false));
handle.native_pixmap_handle.planes.push_back(
- gfx::NativePixmapPlane(size.width(), 0, size.width() * size.height(), 0));
+ gfx::NativePixmapPlane(size.width(), 0, size.width() * size.height()));
handle.native_pixmap_handle.planes.push_back(gfx::NativePixmapPlane(
size.width(), handle.native_pixmap_handle.planes[0].size,
- size.width() * size.height() / 2, 0));
+ size.width() * size.height() / 2));
auto mock_buffer = std::make_unique<MockGpuMemoryBuffer>();
ON_CALL(*mock_buffer, Map()).WillByDefault(Return(true));
diff --git a/chromium/media/capture/video/chromeos/stream_buffer_manager_unittest.cc b/chromium/media/capture/video/chromeos/stream_buffer_manager_unittest.cc
index db8634375bb..d1d5fdc488c 100644
--- a/chromium/media/capture/video/chromeos/stream_buffer_manager_unittest.cc
+++ b/chromium/media/capture/video/chromeos/stream_buffer_manager_unittest.cc
@@ -86,9 +86,9 @@ std::unique_ptr<gfx::GpuMemoryBuffer> CreateMockGpuMemoryBuffer(
fake_handle.native_pixmap_handle.fds.push_back(
base::FileDescriptor(0, false));
fake_handle.native_pixmap_handle.planes.push_back(
- gfx::NativePixmapPlane(1280, 0, 1280 * 720, 0));
+ gfx::NativePixmapPlane(1280, 0, 1280 * 720));
fake_handle.native_pixmap_handle.planes.push_back(
- gfx::NativePixmapPlane(1280, 0, 1280 * 720 / 2, 0));
+ gfx::NativePixmapPlane(1280, 0, 1280 * 720 / 2));
void* fake_mapped_address = reinterpret_cast<void*>(0xdeadbeef);
EXPECT_CALL(*mock_buffer, Map()).WillRepeatedly(Return(true));
diff --git a/chromium/media/gpu/v4l2/generic_v4l2_device.cc b/chromium/media/gpu/v4l2/generic_v4l2_device.cc
index 2e25b93b0c4..241598c39f1 100644
--- a/chromium/media/gpu/v4l2/generic_v4l2_device.cc
+++ b/chromium/media/gpu/v4l2/generic_v4l2_device.cc
@@ -323,7 +323,7 @@ scoped_refptr<gl::GLImage> GenericV4L2Device::CreateGLImage(
for (size_t p = 0; p < num_planes; ++p) {
native_pixmap_handle.planes.emplace_back(
VideoFrame::RowBytes(p, vf_format, size.width()), plane_offset,
- VideoFrame::PlaneSize(vf_format, p, size).GetArea(), 0);
+ VideoFrame::PlaneSize(vf_format, p, size).GetArea());
if (v4l2_plane + 1 < dmabuf_fds.size()) {
++v4l2_plane;
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
index 7f2a5e8a62e..e8f7a373976 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
@@ -1055,17 +1055,8 @@ void VaapiVideoDecodeAccelerator::Cleanup() {
client_ptr_factory_.reset();
weak_this_factory_.InvalidateWeakPtrs();
- decoder_thread_task_runner_->DeleteSoon(FROM_HERE, decoder_.release());
- if (h264_accelerator_) {
- decoder_thread_task_runner_->DeleteSoon(FROM_HERE,
- h264_accelerator_.release());
- } else if (vp8_accelerator_) {
- decoder_thread_task_runner_->DeleteSoon(FROM_HERE,
- vp8_accelerator_.release());
- } else if (vp9_accelerator_) {
- decoder_thread_task_runner_->DeleteSoon(FROM_HERE,
- vp9_accelerator_.release());
- }
+ // TODO(mcasas): consider deleting |decoder_| and |*_accelerator_| on
+ // |decoder_thread_task_runner_|, https://crbug.com/789160.
// Signal all potential waiters on the decoder_thread_, let them early-exit,
// as we've just moved to the kDestroying state, and wait for all tasks
@@ -1154,7 +1145,8 @@ VaapiVideoDecodeAccelerator::VaapiH264Accelerator::VaapiH264Accelerator(
}
VaapiVideoDecodeAccelerator::VaapiH264Accelerator::~VaapiH264Accelerator() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // TODO(mcasas): consider enabling the checker, https://crbug.com/789160
+ // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
scoped_refptr<H264Picture>
@@ -1496,7 +1488,8 @@ VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::VaapiVP8Accelerator(
}
VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::~VaapiVP8Accelerator() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // TODO(mcasas): consider enabling the checker, https://crbug.com/789160
+ // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
scoped_refptr<VP8Picture>
@@ -1732,7 +1725,8 @@ VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::VaapiVP9Accelerator(
}
VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::~VaapiVP9Accelerator() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // TODO(mcasas): consider enabling the checker, https://crbug.com/789160
+ // CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
scoped_refptr<VP9Picture>