Generate the IPlayer interface with AIDL.

This removes the manually rolled IPlayer implementation and instead uses
an aidl generated implementation. The IPlayer aidl file is moved from
frameworks/base/.

Test: run cts --module CtsMediaTestCases
Bug: 64223827
Change-Id: Ia609f7ba1cc6f71ce919d6174dd8b5e0e1b05575
gugelfrei
Ivan Lozano 7 years ago
parent a5ec8b0ec9
commit 8cf3a0788d

@ -37,6 +37,8 @@
namespace android {
namespace media {
// The native VolumeShaper class mirrors the java VolumeShaper class;
// in addition, the native class contains implementation for actual operation.
//
@ -101,7 +103,7 @@ public:
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
class Configuration : public Interpolator<S, T>, public RefBase {
class Configuration : public Interpolator<S, T>, public RefBase, public Parcelable {
public:
// Must match with VolumeShaper.java in frameworks/base.
enum Type : int32_t {
@ -283,7 +285,7 @@ public:
}
// The parcel layout must match VolumeShaper.java
status_t writeToParcel(Parcel *parcel) const {
status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeInt32((int32_t)mType)
?: parcel->writeInt32(mId)
@ -294,17 +296,17 @@ public:
?: Interpolator<S, T>::writeToParcel(parcel);
}
status_t readFromParcel(const Parcel &parcel) {
status_t readFromParcel(const Parcel *parcel) override {
int32_t type, optionFlags;
return parcel.readInt32(&type)
return parcel->readInt32(&type)
?: setType((Type)type)
?: parcel.readInt32(&mId)
?: parcel->readInt32(&mId)
?: mType == TYPE_ID
? NO_ERROR
: parcel.readInt32(&optionFlags)
: parcel->readInt32(&optionFlags)
?: setOptionFlags((OptionFlag)optionFlags)
?: parcel.readDouble(&mDurationMs)
?: Interpolator<S, T>::readFromParcel(parcel)
?: parcel->readDouble(&mDurationMs)
?: Interpolator<S, T>::readFromParcel(*parcel)
?: checkCurve();
}
@ -336,7 +338,7 @@ public:
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
class Operation : public RefBase {
class Operation : public RefBase, public Parcelable {
public:
// Must match with VolumeShaper.java.
enum Flag : int32_t {
@ -418,18 +420,18 @@ public:
return NO_ERROR;
}
status_t writeToParcel(Parcel *parcel) const {
status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeInt32((int32_t)mFlags)
?: parcel->writeInt32(mReplaceId)
?: parcel->writeFloat(mXOffset);
}
status_t readFromParcel(const Parcel &parcel) {
status_t readFromParcel(const Parcel *parcel) override {
int32_t flags;
return parcel.readInt32(&flags)
?: parcel.readInt32(&mReplaceId)
?: parcel.readFloat(&mXOffset)
return parcel->readInt32(&flags)
?: parcel->readInt32(&mReplaceId)
?: parcel->readFloat(&mXOffset)
?: setFlags((Flag)flags);
}
@ -455,7 +457,7 @@ public:
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
class State : public RefBase {
class State : public RefBase, public Parcelable {
public:
State(T volume, S xOffset)
: mVolume(volume)
@ -481,15 +483,15 @@ public:
mXOffset = xOffset;
}
status_t writeToParcel(Parcel *parcel) const {
status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeFloat(mVolume)
?: parcel->writeFloat(mXOffset);
}
status_t readFromParcel(const Parcel &parcel) {
return parcel.readFloat(&mVolume)
?: parcel.readFloat(&mXOffset);
status_t readFromParcel(const Parcel *parcel) override {
return parcel->readFloat(&mVolume)
?: parcel->readFloat(&mXOffset);
}
std::string toString() const {
@ -1020,6 +1022,8 @@ private:
std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase
}; // VolumeHandler
} // namespace media
} // namespace android
#pragma pop_macro("LOG_TAG")

@ -60,7 +60,8 @@ LOCAL_SRC_FILES = \
binding/RingBufferParcelable.cpp \
binding/SharedMemoryParcelable.cpp \
binding/SharedRegionParcelable.cpp \
../../libaudioclient/aidl/android/media/IAudioRecord.aidl
../../libaudioclient/aidl/android/media/IAudioRecord.aidl \
../../libaudioclient/aidl/android/media/IPlayer.aidl
LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror

@ -20,6 +20,7 @@ cc_library_shared {
// The headers for these interfaces will be available to any modules that
// include libaudioclient, at the path "aidl/package/path/BnFoo.h"
"aidl/android/media/IAudioRecord.aidl",
"aidl/android/media/IPlayer.aidl",
"AudioEffect.cpp",
"AudioPolicy.cpp",
@ -49,7 +50,7 @@ cc_library_shared {
],
export_shared_lib_headers: ["libbinder"],
local_include_dirs: ["include/media"],
local_include_dirs: ["include/media", "aidl"],
header_libs: ["libaudioclient_headers"],
export_header_lib_headers: ["libaudioclient_headers"],

@ -39,6 +39,8 @@ static const int kMaxLoopCountNotifications = 32;
namespace android {
// ---------------------------------------------------------------------------
using media::VolumeShaper;
// TODO: Move to a separate .h
template <typename T>
@ -553,7 +555,7 @@ status_t AudioTrack::set(
mFramesWritten = 0;
mFramesWrittenServerOffset = 0;
mFramesWrittenAtRestore = -1; // -1 is a unique initializer.
mVolumeHandler = new VolumeHandler();
mVolumeHandler = new media::VolumeHandler();
return NO_ERROR;
}

@ -28,6 +28,8 @@
namespace android {
using media::VolumeShaper;
enum {
GET_CBLK = IBinder::FIRST_CALL_TRANSACTION,
START,
@ -185,7 +187,7 @@ public:
return nullptr;
}
sp<VolumeShaper::State> state = new VolumeShaper::State;
status = state->readFromParcel(reply);
status = state->readFromParcel(&reply);
if (status != NO_ERROR) {
return nullptr;
}
@ -263,12 +265,12 @@ status_t BnAudioTrack::onTransact(
status_t status = data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
configuration = new VolumeShaper::Configuration();
status = configuration->readFromParcel(data);
status = configuration->readFromParcel(&data);
}
status = status ?: data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
operation = new VolumeShaper::Operation();
status = operation->readFromParcel(data);
status = operation->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = (status_t)applyVolumeShaper(configuration, operation);

@ -22,6 +22,8 @@
namespace android {
using media::VolumeShaper;
//--------------------------------------------------------------------------------------------------
PlayerBase::PlayerBase() : BnPlayer(),
mPanMultiplierL(1.0f), mPanMultiplierR(1.0f),
@ -117,23 +119,26 @@ status_t PlayerBase::stopWithStatus() {
//------------------------------------------------------------------------------
// Implementation of IPlayer
void PlayerBase::start() {
binder::Status PlayerBase::start() {
ALOGD("PlayerBase::start() from IPlayer");
(void)startWithStatus();
return binder::Status::ok();
}
void PlayerBase::pause() {
binder::Status PlayerBase::pause() {
ALOGD("PlayerBase::pause() from IPlayer");
(void)pauseWithStatus();
return binder::Status::ok();
}
void PlayerBase::stop() {
binder::Status PlayerBase::stop() {
ALOGD("PlayerBase::stop() from IPlayer");
(void)stopWithStatus();
return binder::Status::ok();
}
void PlayerBase::setVolume(float vol) {
binder::Status PlayerBase::setVolume(float vol) {
ALOGD("PlayerBase::setVolume() from IPlayer");
{
Mutex::Autolock _l(mSettingsLock);
@ -144,9 +149,10 @@ void PlayerBase::setVolume(float vol) {
if (status != NO_ERROR) {
ALOGW("PlayerBase::setVolume() error %d", status);
}
return binder::Status::fromStatusT(status);
}
void PlayerBase::setPan(float pan) {
binder::Status PlayerBase::setPan(float pan) {
ALOGD("PlayerBase::setPan() from IPlayer");
{
Mutex::Autolock _l(mSettingsLock);
@ -163,22 +169,19 @@ void PlayerBase::setPan(float pan) {
if (status != NO_ERROR) {
ALOGW("PlayerBase::setPan() error %d", status);
}
return binder::Status::fromStatusT(status);
}
void PlayerBase::setStartDelayMs(int32_t delayMs __unused) {
binder::Status PlayerBase::setStartDelayMs(int32_t delayMs __unused) {
ALOGW("setStartDelay() is not supported");
return binder::Status::ok();
}
void PlayerBase::applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration __unused,
const sp<VolumeShaper::Operation>& operation __unused) {
binder::Status PlayerBase::applyVolumeShaper(
const VolumeShaper::Configuration& configuration __unused,
const VolumeShaper::Operation& operation __unused) {
ALOGW("applyVolumeShaper() is not supported");
}
status_t PlayerBase::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
return BnPlayer::onTransact(code, data, reply, flags);
return binder::Status::ok();
}
} // namespace android

@ -18,6 +18,8 @@
namespace android {
using media::VolumeShaper;
//--------------------------------------------------------------------------------------------------
TrackPlayerBase::TrackPlayerBase() : PlayerBase(),
mPlayerVolumeL(1.0f), mPlayerVolumeR(1.0f)
@ -103,18 +105,24 @@ status_t TrackPlayerBase::doSetVolume() {
}
void TrackPlayerBase::applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) {
binder::Status TrackPlayerBase::applyVolumeShaper(
const VolumeShaper::Configuration& configuration,
const VolumeShaper::Operation& operation) {
sp<VolumeShaper::Configuration> spConfiguration = new VolumeShaper::Configuration(configuration);
sp<VolumeShaper::Operation> spOperation = new VolumeShaper::Operation(operation);
if (mAudioTrack != 0) {
ALOGD("TrackPlayerBase::applyVolumeShaper() from IPlayer");
VolumeShaper::Status status = mAudioTrack->applyVolumeShaper(configuration, operation);
VolumeShaper::Status status = mAudioTrack->applyVolumeShaper(spConfiguration, spOperation);
if (status < 0) { // a non-negative value is the volume shaper id.
ALOGE("TrackPlayerBase::applyVolumeShaper() failed with status %d", status);
}
return binder::Status::fromStatusT(status);
} else {
ALOGD("TrackPlayerBase::applyVolumeShaper()"
" no AudioTrack for volume control from IPlayer");
" no AudioTrack for volume control from IPlayer");
return binder::Status::ok();
}
}

@ -0,0 +1,34 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media;
import android.media.VolumeShaper.Configuration;
import android.media.VolumeShaper.Operation;
/**
* @hide
*/
interface IPlayer {
oneway void start();
oneway void pause();
oneway void stop();
oneway void setVolume(float vol);
oneway void setPan(float pan);
oneway void setStartDelayMs(int delayMs);
oneway void applyVolumeShaper(in Configuration configuration,
in Operation operation);
}

@ -0,0 +1,19 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.VolumeShaper;
parcelable Configuration cpp_header "media/VolumeShaper.h";

@ -0,0 +1,19 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.VolumeShaper;
parcelable Operation cpp_header "media/VolumeShaper.h";

@ -0,0 +1,19 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.VolumeShaper;
parcelable State cpp_header "media/VolumeShaper.h";

@ -744,12 +744,12 @@ public:
status_t setParameters(const String8& keyValuePairs);
/* Sets the volume shaper object */
VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation);
media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation);
/* Gets the volume shaper state */
sp<VolumeShaper::State> getVolumeShaperState(int id);
sp<media::VolumeShaper::State> getVolumeShaperState(int id);
/* Get parameters */
String8 getParameters(const String8& keys);
@ -1146,7 +1146,7 @@ protected:
// May not match the app selection depending on other
// activity and connected devices.
sp<VolumeHandler> mVolumeHandler;
sp<media::VolumeHandler> mVolumeHandler;
private:
class DeathNotifier : public IBinder::DeathRecipient {

@ -77,12 +77,12 @@ public:
virtual void signal() = 0;
/* Sets the volume shaper */
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) = 0;
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation) = 0;
/* gets the volume shaper state */
virtual sp<VolumeShaper::State> getVolumeShaperState(int id) = 0;
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) = 0;
};
// ----------------------------------------------------------------------------

@ -17,35 +17,31 @@
#ifndef __ANDROID_PLAYER_BASE_H__
#define __ANDROID_PLAYER_BASE_H__
#include <audiomanager/IPlayer.h>
#include <audiomanager/AudioManager.h>
#include <audiomanager/IAudioManager.h>
#include "android/media/BnPlayer.h"
namespace android {
class PlayerBase : public BnPlayer
class PlayerBase : public ::android::media::BnPlayer
{
public:
explicit PlayerBase();
virtual ~PlayerBase();
virtual ~PlayerBase() override;
virtual void destroy() = 0;
//IPlayer implementation
virtual void start();
virtual void pause();
virtual void stop();
virtual void setVolume(float vol);
virtual void setPan(float pan);
virtual void setStartDelayMs(int32_t delayMs);
virtual void applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) override;
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
virtual binder::Status start() override;
virtual binder::Status pause() override;
virtual binder::Status stop() override;
virtual binder::Status setVolume(float vol) override;
virtual binder::Status setPan(float pan) override;
virtual binder::Status setStartDelayMs(int32_t delayMs) override;
virtual binder::Status applyVolumeShaper(
const media::VolumeShaper::Configuration& configuration,
const media::VolumeShaper::Operation& operation) override;
status_t startWithStatus();
status_t pauseWithStatus();

@ -32,9 +32,9 @@ public:
virtual void destroy();
//IPlayer implementation
virtual void applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation);
virtual binder::Status applyVolumeShaper(
const media::VolumeShaper::Configuration& configuration,
const media::VolumeShaper::Operation& operation);
//FIXME move to protected field, so far made public to minimize changes to AudioTrack logic
sp<AudioTrack> mAudioTrack;

@ -35,6 +35,8 @@
namespace android {
using media::VolumeShaper;
enum {
DISCONNECT = IBinder::FIRST_CALL_TRANSACTION,
SET_DATA_SOURCE_URL,
@ -509,7 +511,7 @@ public:
return nullptr;
}
sp<VolumeShaper::State> state = new VolumeShaper::State();
status = state->readFromParcel(reply);
status = state->readFromParcel(&reply);
if (status != NO_ERROR) {
return nullptr;
}
@ -851,14 +853,14 @@ status_t BnMediaPlayer::onTransact(
status_t status = data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
configuration = new VolumeShaper::Configuration();
status = configuration->readFromParcel(data);
status = configuration->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = data.readInt32(&present);
}
if (status == NO_ERROR && present != 0) {
operation = new VolumeShaper::Operation();
status = operation->readFromParcel(data);
status = operation->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = (status_t)applyVolumeShaper(configuration, operation);

@ -91,10 +91,10 @@ public:
virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) = 0;
virtual status_t setNextPlayer(const sp<IMediaPlayer>& next) = 0;
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) = 0;
virtual sp<VolumeShaper::State> getVolumeShaperState(int id) = 0;
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation) = 0;
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) = 0;
// Modular DRM
virtual status_t prepareDrm(const uint8_t uuid[16],

@ -266,10 +266,10 @@ public:
status_t setRetransmitEndpoint(const char* addrString, uint16_t port);
status_t setNextMediaPlayer(const sp<MediaPlayer>& player);
VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation);
sp<VolumeShaper::State> getVolumeShaperState(int id);
media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation);
sp<media::VolumeShaper::State> getVolumeShaperState(int id);
// Modular DRM
status_t prepareDrm(const uint8_t uuid[16], const Vector<uint8_t>& drmSessionId);
status_t releaseDrm();

@ -48,6 +48,8 @@
namespace android {
using media::VolumeShaper;
MediaPlayer::MediaPlayer()
{
ALOGV("constructor");

@ -93,6 +93,7 @@ using android::OK;
using android::BAD_VALUE;
using android::NOT_ENOUGH_DATA;
using android::Parcel;
using android::media::VolumeShaper;
// Max number of entries in the filter.
const int kMaxFilterSize = 64; // I pulled that out of thin air.
@ -1577,7 +1578,7 @@ MediaPlayerService::AudioOutput::AudioOutput(audio_session_t sessionId, uid_t ui
mSendLevel(0.0),
mAuxEffectId(0),
mFlags(AUDIO_OUTPUT_FLAG_NONE),
mVolumeHandler(new VolumeHandler())
mVolumeHandler(new media::VolumeHandler())
{
ALOGV("AudioOutput(%d)", sessionId);
if (attr != NULL) {

@ -132,10 +132,10 @@ class MediaPlayerService : public BnMediaPlayerService
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) override;
virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation) override;
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
private:
static void setMinBufferCount();
@ -165,7 +165,7 @@ class MediaPlayerService : public BnMediaPlayerService
float mSendLevel;
int mAuxEffectId;
audio_output_flags_t mFlags;
sp<VolumeHandler> mVolumeHandler;
sp<media::VolumeHandler> mVolumeHandler;
mutable Mutex mLock;
// static variables below not protected by mutex
@ -343,10 +343,10 @@ private:
virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint);
virtual status_t setNextPlayer(const sp<IMediaPlayer>& player);
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) override;
virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation) override;
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
sp<MediaPlayerBase> createPlayer(player_type playerType);

@ -146,10 +146,10 @@ public:
virtual status_t setParameters(const String8& /* keyValuePairs */) { return NO_ERROR; }
virtual String8 getParameters(const String8& /* keys */) { return String8::empty(); }
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation);
virtual sp<VolumeShaper::State> getVolumeShaperState(int id);
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation);
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id);
};
MediaPlayerBase() : mCookie(0), mNotify(0) {}

@ -557,10 +557,10 @@ private:
virtual void pause();
virtual status_t attachAuxEffect(int effectId);
virtual status_t setParameters(const String8& keyValuePairs);
virtual VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) override;
virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
virtual media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation) override;
virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
virtual status_t getTimestamp(AudioTimestamp& timestamp);
virtual void signal(); // signal playback thread for a change in control block

@ -82,11 +82,11 @@ public:
virtual bool isFastTrack() const { return (mFlags & AUDIO_OUTPUT_FLAG_FAST) != 0; }
// implement volume handling.
VolumeShaper::Status applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation);
sp<VolumeShaper::State> getVolumeShaperState(int id);
sp<VolumeHandler> getVolumeHandler() { return mVolumeHandler; }
media::VolumeShaper::Status applyVolumeShaper(
const sp<media::VolumeShaper::Configuration>& configuration,
const sp<media::VolumeShaper::Operation>& operation);
sp<media::VolumeShaper::State> getVolumeShaperState(int id);
sp<media::VolumeHandler> getVolumeHandler() { return mVolumeHandler; }
protected:
// for numerous
@ -163,7 +163,7 @@ protected:
ExtendedTimestamp mSinkTimestamp;
sp<VolumeHandler> mVolumeHandler; // handles multiple VolumeShaper configs and operations
sp<media::VolumeHandler> mVolumeHandler; // handles multiple VolumeShaper configs and operations
private:
// The following fields are only for fast tracks, and should be in a subclass

@ -52,6 +52,7 @@
namespace android {
using media::VolumeShaper;
// ----------------------------------------------------------------------------
// TrackBase
// ----------------------------------------------------------------------------
@ -399,7 +400,7 @@ AudioFlinger::PlaybackThread::Track::Track(
mAuxEffectId(0), mHasVolumeController(false),
mPresentationCompleteFrames(0),
mFrameMap(16 /* sink-frame-to-track-frame map memory */),
mVolumeHandler(new VolumeHandler(sampleRate)),
mVolumeHandler(new media::VolumeHandler(sampleRate)),
// mSinkTimestamp
mFastIndex(-1),
mCachedVolume(1.0),

Loading…
Cancel
Save