Fix chromium-style warnings in webrtc/sound/.

Tested on Linux with the following command lines:

$ ./webrtc/build/gyp_webrtc -Dclang_use_chrome_plugins=1
$ ninja -C out/Release rtc_sound

BUG=webrtc:163
R=perkj@webrtc.org

Review URL: https://codereview.webrtc.org/1425533003

Cr-Commit-Position: refs/heads/master@{#10447}
This commit is contained in:
tfarina
2015-10-29 04:50:08 -07:00
committed by Commit bot
parent 95192fbb1e
commit a35ae7f507
12 changed files with 119 additions and 87 deletions

View File

@ -62,7 +62,7 @@ class AlsaDeviceLocator : public SoundDeviceLocator {
&name_);
}
virtual SoundDeviceLocator *Copy() const {
SoundDeviceLocator *Copy() const override {
return new AlsaDeviceLocator(*this);
}
};
@ -242,46 +242,46 @@ class AlsaInputStream :
buffer_size_(0) {
}
virtual ~AlsaInputStream() {
~AlsaInputStream() override {
bool success = StopReading();
// We need that to live.
VERIFY(success);
}
virtual bool StartReading() {
bool StartReading() override {
return StartWork();
}
virtual bool StopReading() {
bool StopReading() override {
return StopWork();
}
virtual bool GetVolume(int *volume) {
bool GetVolume(int *volume) override {
// TODO: Implement this.
return false;
}
virtual bool SetVolume(int volume) {
bool SetVolume(int volume) override {
// TODO: Implement this.
return false;
}
virtual bool Close() {
bool Close() override {
return StopReading() && stream_.Close();
}
virtual int LatencyUsecs() {
int LatencyUsecs() override {
return stream_.CurrentDelayUsecs();
}
private:
// Inherited from Worker.
virtual void OnStart() {
void OnStart() override {
HaveWork();
}
// Inherited from Worker.
virtual void OnHaveWork() {
void OnHaveWork() override {
// Block waiting for data.
snd_pcm_uframes_t avail = stream_.Wait();
if (avail > 0) {
@ -317,7 +317,7 @@ class AlsaInputStream :
}
// Inherited from Worker.
virtual void OnStop() {
void OnStop() override {
// Nothing to do.
}
@ -334,8 +334,7 @@ class AlsaInputStream :
// Implementation of an output stream. See soundoutputstreaminterface.h
// regarding thread-safety.
class AlsaOutputStream :
public SoundOutputStreamInterface,
class AlsaOutputStream : public SoundOutputStreamInterface,
private rtc::Worker {
public:
AlsaOutputStream(AlsaSoundSystem *alsa,
@ -347,22 +346,21 @@ class AlsaOutputStream :
: stream_(alsa, handle, frame_size, wait_timeout_ms, flags, freq) {
}
virtual ~AlsaOutputStream() {
~AlsaOutputStream() override {
bool success = DisableBufferMonitoring();
// We need that to live.
VERIFY(success);
}
virtual bool EnableBufferMonitoring() {
bool EnableBufferMonitoring() override {
return StartWork();
}
virtual bool DisableBufferMonitoring() {
bool DisableBufferMonitoring() override {
return StopWork();
}
virtual bool WriteSamples(const void *sample_data,
size_t size) {
bool WriteSamples(const void *sample_data, size_t size) override {
if (size % stream_.frame_size() != 0) {
// No client of SoundSystemInterface does this, so let's not support it.
// (If we wanted to support it, we'd basically just buffer the fractional
@ -389,32 +387,32 @@ class AlsaOutputStream :
return true;
}
virtual bool GetVolume(int *volume) {
bool GetVolume(int *volume) override {
// TODO: Implement this.
return false;
}
virtual bool SetVolume(int volume) {
bool SetVolume(int volume) override {
// TODO: Implement this.
return false;
}
virtual bool Close() {
bool Close() override {
return DisableBufferMonitoring() && stream_.Close();
}
virtual int LatencyUsecs() {
int LatencyUsecs() override {
return stream_.CurrentDelayUsecs();
}
private:
// Inherited from Worker.
virtual void OnStart() {
void OnStart() override {
HaveWork();
}
// Inherited from Worker.
virtual void OnHaveWork() {
void OnHaveWork() override {
snd_pcm_uframes_t avail = stream_.Wait();
if (avail > 0) {
size_t space = avail * stream_.frame_size();
@ -424,7 +422,7 @@ class AlsaOutputStream :
}
// Inherited from Worker.
virtual void OnStop() {
void OnStop() override {
// Nothing to do.
}

View File

@ -34,25 +34,25 @@ class AlsaSoundSystem : public SoundSystemInterface {
AlsaSoundSystem();
virtual ~AlsaSoundSystem();
~AlsaSoundSystem() override;
virtual bool Init();
virtual void Terminate();
bool Init() override;
void Terminate() override;
virtual bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices);
virtual bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices);
bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices) override;
bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices) override;
virtual bool GetDefaultPlaybackDevice(SoundDeviceLocator **device);
virtual bool GetDefaultCaptureDevice(SoundDeviceLocator **device);
bool GetDefaultPlaybackDevice(SoundDeviceLocator **device) override;
bool GetDefaultCaptureDevice(SoundDeviceLocator **device) override;
virtual SoundOutputStreamInterface *OpenPlaybackDevice(
SoundOutputStreamInterface *OpenPlaybackDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
virtual SoundInputStreamInterface *OpenCaptureDevice(
const OpenParams &params) override;
SoundInputStreamInterface *OpenCaptureDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
const OpenParams &params) override;
virtual const char *GetName() const;
const char *GetName() const override;
private:
bool IsInitialized() { return initialized_; }

View File

@ -16,9 +16,7 @@
#include "webrtc/base/logging.h"
namespace rtc {
class Thread;
}
namespace rtc {
@ -30,69 +28,68 @@ class NullSoundDeviceLocator : public SoundDeviceLocator {
public:
NullSoundDeviceLocator() : SoundDeviceLocator(kNullName, kNullName) {}
virtual SoundDeviceLocator *Copy() const {
SoundDeviceLocator *Copy() const override {
return new NullSoundDeviceLocator();
}
};
class NullSoundInputStream : public SoundInputStreamInterface {
public:
virtual bool StartReading() {
bool StartReading() override {
return true;
}
virtual bool StopReading() {
bool StopReading() override {
return true;
}
virtual bool GetVolume(int *volume) {
bool GetVolume(int *volume) override {
*volume = SoundSystemInterface::kMinVolume;
return true;
}
virtual bool SetVolume(int volume) {
bool SetVolume(int volume) override {
return false;
}
virtual bool Close() {
bool Close() override {
return true;
}
virtual int LatencyUsecs() {
int LatencyUsecs() override {
return 0;
}
};
class NullSoundOutputStream : public SoundOutputStreamInterface {
public:
virtual bool EnableBufferMonitoring() {
bool EnableBufferMonitoring() override {
return true;
}
virtual bool DisableBufferMonitoring() {
bool DisableBufferMonitoring() override {
return true;
}
virtual bool WriteSamples(const void *sample_data,
size_t size) {
bool WriteSamples(const void *sample_data, size_t size) override {
LOG(LS_VERBOSE) << "Got " << size << " bytes of playback samples";
return true;
}
virtual bool GetVolume(int *volume) {
bool GetVolume(int *volume) override {
*volume = SoundSystemInterface::kMinVolume;
return true;
}
virtual bool SetVolume(int volume) {
bool SetVolume(int volume) override {
return false;
}
virtual bool Close() {
bool Close() override {
return true;
}
virtual int LatencyUsecs() {
int LatencyUsecs() override {
return 0;
}
};

View File

@ -27,25 +27,25 @@ class NullSoundSystem : public SoundSystemInterface {
return new NullSoundSystem();
}
virtual ~NullSoundSystem();
~NullSoundSystem() override;
virtual bool Init();
virtual void Terminate();
bool Init() override;
void Terminate() override;
virtual bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices);
virtual bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices);
bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices) override;
bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices) override;
virtual SoundOutputStreamInterface *OpenPlaybackDevice(
SoundOutputStreamInterface *OpenPlaybackDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
virtual SoundInputStreamInterface *OpenCaptureDevice(
const OpenParams &params) override;
SoundInputStreamInterface *OpenCaptureDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
const OpenParams &params) override;
virtual bool GetDefaultPlaybackDevice(SoundDeviceLocator **device);
virtual bool GetDefaultCaptureDevice(SoundDeviceLocator **device);
bool GetDefaultPlaybackDevice(SoundDeviceLocator **device) override;
bool GetDefaultCaptureDevice(SoundDeviceLocator **device) override;
virtual const char *GetName() const;
const char *GetName() const override;
};
} // namespace rtc

View File

@ -20,12 +20,12 @@ namespace rtc {
class NullSoundSystemFactory : public SoundSystemFactory {
public:
NullSoundSystemFactory();
virtual ~NullSoundSystemFactory();
~NullSoundSystemFactory() override;
protected:
// Inherited from SoundSystemFactory.
virtual bool SetupInstance();
virtual void CleanupInstance();
bool SetupInstance() override;
void CleanupInstance() override;
};
} // namespace rtc

View File

@ -20,16 +20,14 @@ namespace rtc {
class PlatformSoundSystemFactory : public SoundSystemFactory {
public:
PlatformSoundSystemFactory();
virtual ~PlatformSoundSystemFactory();
~PlatformSoundSystemFactory() override;
protected:
// Inherited from SoundSystemFactory.
virtual bool SetupInstance();
virtual void CleanupInstance();
bool SetupInstance() override;
void CleanupInstance() override;
};
} // namespace rtc
#endif // WEBRTC_SOUND_PLATFORMSOUNDSYSTEMFACTORY_H_

View File

@ -26,7 +26,9 @@
'platformsoundsystemfactory.cc',
'platformsoundsystemfactory.h',
'sounddevicelocator.h',
'soundinputstreaminterface.cc',
'soundinputstreaminterface.h',
'soundoutputstreaminterface.cc',
'soundoutputstreaminterface.h',
'soundsystemfactory.h',
'soundsysteminterface.cc',

View File

@ -0,0 +1,18 @@
/*
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/sound/soundinputstreaminterface.h"
namespace rtc {
SoundInputStreamInterface::~SoundInputStreamInterface() {}
SoundInputStreamInterface::SoundInputStreamInterface() {}
} // namespace rtc

View File

@ -21,7 +21,7 @@ namespace rtc {
// for rtc::Worker.
class SoundInputStreamInterface {
public:
virtual ~SoundInputStreamInterface() {}
virtual ~SoundInputStreamInterface();
// Starts the reading of samples on the current thread.
virtual bool StartReading() = 0;
@ -57,7 +57,7 @@ class SoundInputStreamInterface {
SoundInputStreamInterface *> SignalSamplesRead;
protected:
SoundInputStreamInterface() {}
SoundInputStreamInterface();
private:
RTC_DISALLOW_COPY_AND_ASSIGN(SoundInputStreamInterface);

View File

@ -0,0 +1,19 @@
/*
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/sound/soundoutputstreaminterface.h"
namespace rtc {
SoundOutputStreamInterface::~SoundOutputStreamInterface() {}
SoundOutputStreamInterface::SoundOutputStreamInterface() {}
} // namespace rtc

View File

@ -21,7 +21,7 @@ namespace rtc {
// DisableBufferMonitoring() are the same as for rtc::Worker.
class SoundOutputStreamInterface {
public:
virtual ~SoundOutputStreamInterface() {}
virtual ~SoundOutputStreamInterface();
// Enables monitoring the available buffer space on the current thread.
virtual bool EnableBufferMonitoring() = 0;
@ -61,7 +61,7 @@ class SoundOutputStreamInterface {
sigslot::signal2<size_t, SoundOutputStreamInterface *> SignalBufferSpace;
protected:
SoundOutputStreamInterface() {}
SoundOutputStreamInterface();
private:
RTC_DISALLOW_COPY_AND_ASSIGN(SoundOutputStreamInterface);

View File

@ -25,18 +25,18 @@ class SoundSystemProxy : public SoundSystemInterface {
// Each of these methods simply defers to wrapped_ if non-NULL, else fails.
virtual bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices);
virtual bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices);
bool EnumeratePlaybackDevices(SoundDeviceLocatorList *devices) override;
bool EnumerateCaptureDevices(SoundDeviceLocatorList *devices) override;
virtual bool GetDefaultPlaybackDevice(SoundDeviceLocator **device);
virtual bool GetDefaultCaptureDevice(SoundDeviceLocator **device);
bool GetDefaultPlaybackDevice(SoundDeviceLocator **device) override;
bool GetDefaultCaptureDevice(SoundDeviceLocator **device) override;
virtual SoundOutputStreamInterface *OpenPlaybackDevice(
SoundOutputStreamInterface *OpenPlaybackDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
virtual SoundInputStreamInterface *OpenCaptureDevice(
const OpenParams &params) override;
SoundInputStreamInterface *OpenCaptureDevice(
const SoundDeviceLocator *device,
const OpenParams &params);
const OpenParams &params) override;
protected:
SoundSystemInterface *wrapped_;