fix typos

Signed-off-by: Neil Chen <jingsi.chen@petalmail.com>
This commit is contained in:
Neil Chen
2022-06-28 06:46:41 +08:00
parent 1d5f925f47
commit c3948e0ee6
27 changed files with 54 additions and 54 deletions
+3 -3
View File
@@ -177,12 +177,12 @@ You can use APIs provided in this repository to convert audio data into audible
bytesWritten += retBytes;
}
```
9. Incase of audio interrupts, application can encounter write failures. Interrupt unaware applications can check the renderer state using **GetStatus** API before writing audio data further.
9. In case of audio interrupts, application can encounter write failures. Interrupt unaware applications can check the renderer state using **GetStatus** API before writing audio data further.
Interrupt aware applications will have more details accessible via AudioRendererCallback..
```
while ((bytesWritten < bytesToWrite) && ((bytesToWrite - bytesWritten) > minBytes)) {
int32_t retBytes = audioRenderer->Write(buffer.get() + bytesWritten, bytesToWrite - bytesWritten);
if (retBytes < 0) { // Error occured
if (retBytes < 0) { // Error occurred
if (audioRenderer_->GetStatus() == RENDERER_PAUSED) { // Query the state and take appropriate action
isRenderPaused_ = true;
int32_t seekPos = bytesWritten - bytesToWrite;
@@ -349,7 +349,7 @@ You can use the APIs provided in [**audio_system_manager.h**](https://gitee.com/
bool isDevActive = audioSystemMgr->IsDeviceActive(deviceType);
```
9. Use **SetDeviceChangeCallback** API to register for device change events. Clients will recieve callback when a device is connected/disconnected. Currently audio subsystem supports sending device change events for WIRED_HEADSET, USB_HEADSET and BLUETOOTH_A2DP device.
9. Use **SetDeviceChangeCallback** API to register for device change events. Clients will receive callback when a device is connected/disconnected. Currently audio subsystem supports sending device change events for WIRED_HEADSET, USB_HEADSET and BLUETOOTH_A2DP device.
**OnDeviceChange** function will be called and client will receive **DeviceChangeAction** object, which will contain following parameters:\
*type* : **DeviceChangeType** which specifies whether device is connected or disconnected.\
*deviceDescriptors* : Array of **AudioDeviceDescriptor** object which specifies the type of device and its role(input/output device).
+1 -1
View File
@@ -159,7 +159,7 @@ PCMPulse Code Modulation),即脉冲编码调制,是一种将模拟信
if (bytesRead < 0) {
break;
} else if (bytesRead > 0) {
fwrite(buffer, size, bytesRead, recFile); // example shows writes the recored data into a file
fwrite(buffer, size, bytesRead, recFile); // example shows writes the recorded data into a file
numBuffersToCapture--;
}
}
@@ -643,7 +643,7 @@ void AudioRendererNapi::PauseAsyncCallbackComplete(napi_env env, napi_status sta
napi_delete_reference(env, asyncContext->callbackRef);
}
napi_delete_async_work(env, asyncContext->work);
// Pause failed . Contine Write
// Pause failed . Continue Write
if (!asyncContext->isTrue) {
HiLog::Info(LABEL, "PauseAsyncCallbackComplete: Pasue failed, Continue Write");
if (!asyncContext->objectInfo->writeRequestQ_.empty()) {
@@ -43,7 +43,7 @@ public:
class AudioServiceAdapter {
public:
/**
* @brief creater audioserviceadapter instance
* @brief create audioserviceadapter instance
*
* @param cb callback reference for AudioServiceAdapterCallback class
* @return Returns instance of class that extends AudioServiceAdapter
@@ -745,7 +745,7 @@ int32_t AudioRendererSinkGetTransactionId(uint64_t *transactionId)
}
if (!transactionId) {
AUDIO_ERR_LOG("AudioRendererSinkGetTransactionId failed transacion id null");
AUDIO_ERR_LOG("AudioRendererSinkGetTransactionId failed transaction id null");
return ERR_INVALID_PARAM;
}
@@ -265,7 +265,7 @@ int32_t BluetoothRendererSink::Init(const BluetoothSinkAttr &attr)
}
if (CreateRender(audioPort) != 0) {
AUDIO_ERR_LOG("Create render faied");
AUDIO_ERR_LOG("Create render failed");
return ERR_NOT_STARTED;
}
@@ -649,7 +649,7 @@ int32_t BluetoothRendererSinkGetTransactionId(uint64_t *transactionId)
}
if (!transactionId) {
AUDIO_ERR_LOG("BluetoothRendererSinkGetTransactionId failed transacion id null");
AUDIO_ERR_LOG("BluetoothRendererSinkGetTransactionId failed transaction id null");
return ERR_INVALID_PARAM;
}
@@ -48,7 +48,7 @@ struct DeviceChangeAction {
};
// AudioManagerCallback OnInterrupt is added to handle compilation error in call manager
// Once call manager adapt to new interrupt APIs, this will be rmeoved
// Once call manager adapt to new interrupt APIs, this will be removed
class AudioManagerCallback {
public:
virtual ~AudioManagerCallback() = default;
@@ -225,7 +225,7 @@ public:
int32_t UnregisterVolumeKeyEventCallback(const int32_t clientPid);
// Below APIs are added to handle compilation error in call manager
// Once call manager adapt to new interrupt APIs, this will be rmeoved
// Once call manager adapt to new interrupt APIs, this will be removed
int32_t SetAudioManagerCallback(const AudioSystemManager::AudioVolumeType streamType,
const std::shared_ptr<AudioManagerCallback> &callback);
int32_t UnsetAudioManagerCallback(const AudioSystemManager::AudioVolumeType streamType) const;
@@ -101,7 +101,7 @@ public:
class AudioRenderer {
public:
/**
* @brief creater renderer instance.
* @brief create renderer instance.
*
* @param audioStreamType The audio streamtype to be created.
* refer AudioStreamType in audio_info.h.
@@ -120,7 +120,7 @@ public:
static std::unique_ptr<AudioRenderer> Create(AudioStreamType audioStreamType, const AppInfo &appInfo);
/**
* @brief creater renderer instance.
* @brief create renderer instance.
*
* @param rendererOptions The audio renderer configuration to be used while creating renderer instance.
* refer AudioRendererOptions in audio_info.h.
@@ -129,7 +129,7 @@ public:
static std::unique_ptr<AudioRenderer> Create(const AudioRendererOptions &rendererOptions);
/**
* @brief creater renderer instance.
* @brief create renderer instance.
*
* @param rendererOptions The audio renderer configuration to be used while creating renderer instance.
* refer AudioRendererOptions in audio_info.h.
@@ -174,9 +174,9 @@ public:
/**
* @brief Registers the renderer callback listener.
* (1)If using old SetParams(const AudioCapturerParams params) API,
* this API must be called immediatley after SetParams.
* this API must be called immediately after SetParams.
* (2) Else if using Create(const AudioRendererOptions &rendererOptions),
* this API must be called immediatley after Create.
* this API must be called immediately after Create.
*
* @return Returns {@link SUCCESS} if callback registration is successful; returns an error code
* defined in {@link audio_errors.h} otherwise.
@@ -306,7 +306,7 @@ public:
* @brief Obtains a reasonable minimum buffer size for rendering, however, the renderer can
* accept other write sizes as well.
*
* @param bufferSize Indicates the reference variable into which buffer size value wil be written.
* @param bufferSize Indicates the reference variable into which buffer size value will be written.
* @return Returns {@link SUCCESS} if bufferSize is successfully obtained; returns an error code
* defined in {@link audio_errors.h} otherwise.
*/
@@ -60,7 +60,7 @@ public:
* @param volume Configures the volume at which the ringtone has to be played
* @param loop Boolean parameter indicating whether to enable or disable looping
* @return Returns {@link MSERR_OK} if the looping parameter is set successfully to player;
* retuns an error code defined in {@link media_errors.h} otherwise.
* returns an error code defined in {@link media_errors.h} otherwise.
* @since 1.0
* @version 1.0
*/
@@ -70,7 +70,7 @@ public:
* @brief Start playing ringtone
*
* @return Returns {@link MSERR_OK} if the looping parameter is set successfully to player;
* retuns an error code defined in {@link media_errors.h} otherwise.
* returns an error code defined in {@link media_errors.h} otherwise.
* @since 1.0
* @version 1.0
*/
@@ -80,7 +80,7 @@ public:
* @brief Stop playing ringtone
*
* @return Returns {@link MSERR_OK} if the looping parameter is set successfully to player;
* retuns an error code defined in {@link media_errors.h} otherwise.
* returns an error code defined in {@link media_errors.h} otherwise.
* @since 1.0
* @version 1.0
*/
@@ -90,7 +90,7 @@ public:
* @brief Returns the audio contetnt type and stream uage details to the clients
*
* @return Returns {@link MSERR_OK} if the looping parameter is set successfully to player;
* retuns an error code defined in {@link media_errors.h} otherwise.
* returns an error code defined in {@link media_errors.h} otherwise.
* @since 1.0
* @version 1.0
*/
@@ -100,7 +100,7 @@ public:
* @brief Returns the title of the uri set.
*
* @return Returns title as string if the title is obtained successfully from media library.
* retuns an empty string otherwise.
* returns an empty string otherwise.
* @since 1.0
* @version 1.0
*/
@@ -110,7 +110,7 @@ public:
* @brief Releases the ringtone client resources
*
* @return Returns {@link MSERR_OK} if the looping parameter is set successfully to player;
* retuns an error code defined in {@link media_errors.h} otherwise.
* returns an error code defined in {@link media_errors.h} otherwise.
* @since 1.0
* @version 1.0
*/
+1 -1
View File
@@ -803,7 +803,7 @@ declare namespace audio {
*/
enum StreamUsage {
/**
* Unkown usage.
* Unknown usage.
* @since 8
*/
STREAM_USAGE_UNKNOWN = 0,
@@ -353,7 +353,7 @@ declare namespace audio {
*/
enum StreamUsage {
/**
* Unkown usage.
* Unknown usage.
* @since 7
*/
STREAM_USAGE_UNKNOWN = 0,
@@ -1591,8 +1591,8 @@ declare namespace audio {
/**
* Sets the ringtone uri.
* @param context Indicates the Context object on OHOS
* @param uri Indicated which uri to be set for the tone type
* @param type Indicats the type of the tone
* @param uri Indicates which uri to be set for the tone type
* @param type Indicates the type of the tone
* @param callback Callback object to be passed along with request
* @since 1.0
* @version 1.0
@@ -1602,7 +1602,7 @@ declare namespace audio {
/**
* Sets the ringtone uri.
* @param context Indicates the Context object on OHOS
* @param type Indicats the type of the tone
* @param type Indicates the type of the tone
* @param callback Callback object to be passed along with request
* @return Returns uri of the ringtone
* @since 1.0
@@ -1613,7 +1613,7 @@ declare namespace audio {
/**
* Gets the ringtone player.
* @param context Indicates the Context object on OHOS
* @param type Indicats the type of the tone
* @param type Indicates the type of the tone
* @param callback Callback object to be passed along with request
* @return Returns ringtone player object
* @since 1.0
@@ -1624,7 +1624,7 @@ declare namespace audio {
/**
* Sets the notification uri.
* @param context Indicates the Context object on OHOS
* @param uri Indicats the uri of the notification
* @param uri Indicates the uri of the notification
* @param callback Callback object to be passed along with request
* @since 1.0
* @version 1.0
@@ -1644,7 +1644,7 @@ declare namespace audio {
/**
* Sets the alarm uri.
* @param context Indicates the Context object on OHOS
* @param uri Indicats the uri of the alarm
* @param uri Indicates the uri of the alarm
* @param callback Callback object to be passed along with request
* @since 1.0
* @version 1.0
+3 -3
View File
@@ -44,7 +44,7 @@ public:
* Sets Microphone Mute status.
*
* @param isMute Mute status true or false to be set.
* @return Returns 0 if success. Otherise returns Errocode defined in audio_errors.h.
* @return Returns 0 if success. Otherwise returns Errocode defined in audio_errors.h.
*/
virtual int32_t SetMicrophoneMute(bool isMute) = 0;
@@ -60,7 +60,7 @@ public:
*
* @param audioScene Audio scene type.
* @param activeDevice Currently active priority device
* @return Returns 0 if success. Otherise returns Errocode defined in audio_errors.h.
* @return Returns 0 if success. Otherwise returns Errocode defined in audio_errors.h.
*/
virtual int32_t SetAudioScene(AudioScene audioScene, DeviceType activeDevice) = 0;
@@ -91,7 +91,7 @@ public:
/**
* Update the audio route after device is detected and route is decided
*
* @return Returns 0 if success. Otherise returns Errocode defined in audio_errors.h.
* @return Returns 0 if success. Otherwise returns Errocode defined in audio_errors.h.
*/
virtual int32_t UpdateActiveDeviceRoute(DeviceType type, DeviceFlag flag) = 0;
@@ -492,7 +492,7 @@ public:
/**
* @brief Verifies the clients permsiion based on appTokenId
*
* @return Retruns whether the authentication was success or not
* @return Returns whether the authentication was success or not
*/
bool VerifyClientPermission(const std::string &permissionName, uint32_t appTokenId);
@@ -765,7 +765,7 @@ int32_t AudioPolicyProxy::RegisterAudioRendererEventListener(const int32_t clien
data.WriteRemoteObject(object);
int32_t error = Remote() ->SendRequest(REGISTER_PLAYBACK_EVENT, data, reply, option);
if (error != ERR_NONE) {
AUDIO_ERR_LOG("RegisterAudioRendererEventListener register playback event faild , error: %d", error);
AUDIO_ERR_LOG("RegisterAudioRendererEventListener register playback event failed , error: %d", error);
return ERROR;
}
@@ -835,7 +835,7 @@ int32_t AudioPolicyProxy::RegisterAudioCapturerEventListener(const int32_t clien
data.WriteRemoteObject(object);
int32_t error = Remote() ->SendRequest(REGISTER_RECORDING_EVENT, data, reply, option);
if (error != ERR_NONE) {
AUDIO_ERR_LOG("RegisterAudioCapturerEventListener recording event faild , error: %d", error);
AUDIO_ERR_LOG("RegisterAudioCapturerEventListener recording event failed , error: %d", error);
return ERROR;
}
@@ -858,7 +858,7 @@ int32_t AudioPolicyProxy::UnregisterAudioCapturerEventListener(const int32_t cli
data.WriteInt32(clientUID);
int32_t error = Remote() ->SendRequest(UNREGISTER_RECORDING_EVENT, data, reply, option);
if (error != ERR_NONE) {
AUDIO_ERR_LOG("UnregisterAudioCapturerEventListener recording event faild , error: %d", error);
AUDIO_ERR_LOG("UnregisterAudioCapturerEventListener recording event failed , error: %d", error);
return ERROR;
}
@@ -878,7 +878,7 @@ int32_t AudioPolicyServer::DeactivateAudioInterrupt(const AudioInterrupt &audioI
}
if (curActiveOwnersList_.empty() && pendingOwnersList_.empty()) {
AUDIO_DEBUG_LOG("AudioPolicyServer: No ther session active or pending. Deactivate complete, return success");
AUDIO_DEBUG_LOG("AudioPolicyServer: No other session active or pending. Deactivate complete, return success");
AUDIO_DEBUG_LOG("AudioPolicyServer: DeactivateAudioInterrupt start: print active and pending lists");
PrintOwnersLists();
return SUCCESS;
@@ -44,7 +44,7 @@ int32_t AudioStreamCollector::RegisterAudioRendererEventListener(int32_t clientU
std::lock_guard<std::mutex> lock(rendererStateChangeEventMutex_);
CHECK_AND_RETURN_RET_LOG(object != nullptr, ERR_INVALID_PARAM,
"AudioStreamCollector:set renderer state change event listner object is nullptr");
"AudioStreamCollector:set renderer state change event listener object is nullptr");
sptr<IStandardRendererStateChangeListener> listener = iface_cast<IStandardRendererStateChangeListener>(object);
CHECK_AND_RETURN_RET_LOG(listener != nullptr, ERR_INVALID_PARAM,
@@ -71,7 +71,7 @@ int32_t AudioStreamCollector::RegisterAudioCapturerEventListener(int32_t clientU
std::lock_guard<std::mutex> lock(capturerStateChangeEventMutex_);
CHECK_AND_RETURN_RET_LOG(object != nullptr, ERR_INVALID_PARAM,
"AudioStreamCollector:set capturer event listner object is nullptr");
"AudioStreamCollector:set capturer event listener object is nullptr");
sptr<IStandardCapturerStateChangeListener> listener = iface_cast<IStandardCapturerStateChangeListener>(object);
CHECK_AND_RETURN_RET_LOG(listener != nullptr, ERR_INVALID_PARAM, "AudioStreamCollector: capturer obj cast failed");
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Focus policies to fallback to, incase of unknown usecases */ -->
<!-- Focus policies to fallback to, in case of unknown usecases */ -->
<audio_focus_policy>
<stream_type value="STREAM_MUSIC">
<focus_table>
@@ -87,7 +87,7 @@ int32_t AudioAdapterManager::SetStreamVolume(AudioStreamType streamType, float v
return ERR_OPERATION_FAILED;
}
// Incase if KvStore didnot connect during bootup
// In case if KvStore didnot connect during bootup
if (mAudioPolicyKvStore == nullptr) {
bool isFirstBoot = false;
InitAudioPolicyKvStore(isFirstBoot);
@@ -207,7 +207,7 @@ int32_t AudioAdapterManager::SetRingerMode(AudioRingerMode ringerMode)
{
mRingerMode = ringerMode;
// Incase if KvStore didnot connect during bootup
// In case if KvStore didnot connect during bootup
if (mAudioPolicyKvStore == nullptr) {
bool isFirstBoot = false;
InitAudioPolicyKvStore(isFirstBoot);
@@ -892,7 +892,7 @@ int32_t AudioServiceClient::CreateStream(AudioStreamParams audioParams, AudioStr
pa_proplist_sets(propList, "stream.sessionID", std::to_string(pa_context_get_index(context)).c_str());
pa_proplist_sets(propList, "stream.startTime", streamStartTime.c_str());
AUDIO_ERR_LOG("Creating stream fo channels %{public}d", audioParams.channels);
AUDIO_ERR_LOG("Creating stream of channels %{public}d", audioParams.channels);
pa_channel_map map;
if (audioParams.channels > CHANNEL_6) {
pa_channel_map_init(&map);
@@ -674,7 +674,7 @@ bool AudioSystemManager::RequestIndependentInterrupt(FocusType focusType)
audioInterrupt.streamType = AudioStreamType::STREAM_RECORDING;
audioInterrupt.sessionID = clientID;
int32_t result = AudioSystemManager::GetInstance()->RequestAudioFocus(audioInterrupt);
AUDIO_INFO_LOG("AudioSystemManager: requestIndependentInterrupt : reuslt -> %{public}d", result);
AUDIO_INFO_LOG("AudioSystemManager: requestIndependentInterrupt : result -> %{public}d", result);
return (result == SUCCESS) ? true:false;
}
bool AudioSystemManager::AbandonIndependentInterrupt(FocusType focusType)
@@ -687,7 +687,7 @@ bool AudioSystemManager::AbandonIndependentInterrupt(FocusType focusType)
audioInterrupt.streamType = AudioStreamType::STREAM_RECORDING;
audioInterrupt.sessionID = clientID;
int32_t result = AudioSystemManager::GetInstance()->AbandonAudioFocus(audioInterrupt);
AUDIO_INFO_LOG("AudioSystemManager: abandonIndependentInterrupt : reuslt -> %{public}d", result);
AUDIO_INFO_LOG("AudioSystemManager: abandonIndependentInterrupt : result -> %{public}d", result);
return (result == SUCCESS) ? true:false;
}
+1 -1
View File
@@ -153,7 +153,7 @@ public:
}
if (fwrite(buffer.get(), size, bytesRead, pFile) != bytesRead) {
AUDIO_ERR_LOG("error occured in fwrite");
AUDIO_ERR_LOG("error occurred in fwrite");
}
numBuffersToCapture--;
if ((numBuffersToCapture == AudioTestConstants::PAUSE_BUFFER_POSITION)
+1 -1
View File
@@ -341,7 +341,7 @@ int main(int argc, char* argv[])
PrintUsage();
break;
default:
cout << "Unsuported option. Exiting!!!" << endl;
cout << "Unsupported option. Exiting!!!" << endl;
exit(0);
break;
}
+1 -1
View File
@@ -228,7 +228,7 @@ public:
}
if (fwrite(buffer.get(), size, bytesRead, pFile) != bytesRead) {
AUDIO_ERR_LOG("error occured in fwrite");
AUDIO_ERR_LOG("error occurred in fwrite");
}
numBuffersToCapture--;
}
@@ -134,7 +134,7 @@ void InterruptMultiRendererTest::WriteBuffer(AudioRenderer* audioRenderer, FILE*
int32_t retBytes = audioRenderer->Write(buffer.get() + bytesWritten,
bytesToWrite - bytesWritten);
if (retBytes < 0) {
AUDIO_ERR_LOG("InterruptMultiRendererTest: Error occured in writing buffer: %{public}d", retBytes);
AUDIO_ERR_LOG("InterruptMultiRendererTest: Error occurred in writing buffer: %{public}d", retBytes);
if (audioRenderer->GetStatus() == RENDERER_PAUSED) {
cb->isRendererPaused_ = true;
int32_t seekPos = bytesWritten - bytesToWrite;
+1 -1
View File
@@ -24,7 +24,7 @@ struct WAV_HEADER {
uint8_t fmt[4] = {'f', 'm', 't', ' '}; // FMT header
uint32_t Subchunk1Size = 16; // Size of the fmt chunk
uint16_t AudioFormat = 1; // Audio format 1=PCM
uint16_t NumOfChan = 2; // Number of channels 1=Mono 2=Sterio
uint16_t NumOfChan = 2; // Number of channels 1=Mono 2=Stereo
uint32_t SamplesPerSec = 44100; // Sampling Frequency in Hz
uint32_t bytesPerSec = 176400; // bytes per second
uint16_t blockAlign = 2; // 2=16-bit mono, 4=16-bit stereo
@@ -118,7 +118,7 @@ HWTEST(AudioManagerUnitTest, SetDeviceActive_004, TestSize.Level0)
auto ret = AudioSystemManager::GetInstance()->SetDeviceActive(ActiveDeviceType::ACTIVE_DEVICE_TYPE_NONE, true);
EXPECT_NE(SUCCESS, ret);
// On bootup sco wont be connected. Hence activation should fail
// On bootup sco won't be connected. Hence activation should fail
ret = AudioSystemManager::GetInstance()->SetDeviceActive(ActiveDeviceType::BLUETOOTH_SCO, true);
EXPECT_NE(SUCCESS, ret);
@@ -741,7 +741,7 @@ HWTEST(AudioStreamManagerUnitTest, Audio_Stream_Change_Listner_RendererStateChan
g_audioManagerInstance->UnregisterAudioRendererEventListener(getpid());
}
// Capturer Listner Unit Cases
// Capturer Listener Unit Cases
/**
* @tc.name : Test RegisterAudioCapturerEventListener API
* @tc.number: Audio_Stream_Change_Listner_RegisterAudioCapturerEventListener_001