Make AudioFrameType an enum class, and move to audio_coding_module_typedefs.h

Bug: webrtc:5876
Change-Id: I0c92f9410fcf0832bfa321229b3437134255dba6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128085
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27190}
This commit is contained in:
Niels Möller
2019-03-19 14:10:16 +01:00
committed by Commit Bot
parent 1d14af908e
commit c936cb6a86
21 changed files with 91 additions and 102 deletions

View File

@ -39,7 +39,7 @@ int32_t Channel::SendData(AudioFrameType frameType,
? timeStamp
: static_cast<uint32_t>(external_send_timestamp_);
if (frameType == kEmptyFrame) {
if (frameType == AudioFrameType::kEmptyFrame) {
// When frame is empty, we should not transmit it. The frame size of the
// next non-empty frame will be based on the previous frame size.
_useLastFrameSize = _lastFrameSizeSample > 0;

View File

@ -75,7 +75,7 @@ int32_t TestPack::SendData(AudioFrameType frame_type,
rtp_header.payloadType = payload_type;
rtp_header.timestamp = timestamp;
if (frame_type == kEmptyFrame) {
if (frame_type == AudioFrameType::kEmptyFrame) {
// Skip this frame.
return 0;
}

View File

@ -54,7 +54,7 @@ int32_t TestPackStereo::SendData(const AudioFrameType frame_type,
rtp_header.sequenceNumber = seq_no_++;
rtp_header.payloadType = payload_type;
rtp_header.timestamp = timestamp;
if (frame_type == kEmptyFrame) {
if (frame_type == AudioFrameType::kEmptyFrame) {
// Skip this frame
return 0;
}
@ -63,7 +63,7 @@ int32_t TestPackStereo::SendData(const AudioFrameType frame_type,
status =
receiver_acm_->IncomingPacket(payload_data, payload_size, rtp_header);
if (frame_type != kAudioFrameCN) {
if (frame_type != AudioFrameType::kAudioFrameCN) {
payload_size_ = static_cast<int>(payload_size);
} else {
payload_size_ = -1;

View File

@ -34,17 +34,18 @@ ActivityMonitor::ActivityMonitor() {
}
int32_t ActivityMonitor::InFrameType(AudioFrameType frame_type) {
counter_[frame_type]++;
counter_[static_cast<int>(frame_type)]++;
return 0;
}
void ActivityMonitor::PrintStatistics() {
printf("\n");
printf("kEmptyFrame %u\n", counter_[kEmptyFrame]);
printf("kAudioFrameSpeech %u\n", counter_[kAudioFrameSpeech]);
printf("kAudioFrameCN %u\n", counter_[kAudioFrameCN]);
printf("kVideoFrameKey %u\n", counter_[kVideoFrameKey]);
printf("kVideoFrameDelta %u\n", counter_[kVideoFrameDelta]);
printf("kEmptyFrame %u\n",
counter_[static_cast<int>(AudioFrameType::kEmptyFrame)]);
printf("kAudioFrameSpeech %u\n",
counter_[static_cast<int>(AudioFrameType::kAudioFrameSpeech)]);
printf("kAudioFrameCN %u\n",
counter_[static_cast<int>(AudioFrameType::kAudioFrameCN)]);
printf("\n\n");
}
@ -146,7 +147,7 @@ void TestVadDtx::Run(std::string in_filename,
monitor_->PrintStatistics();
#endif
uint32_t stats[5];
uint32_t stats[3];
monitor_->GetStatistics(stats);
monitor_->ResetStatistics();

View File

@ -34,9 +34,7 @@ class ActivityMonitor : public ACMVADCallback {
// 0 - kEmptyFrame
// 1 - kAudioFrameSpeech
// 2 - kAudioFrameCN
// 3 - kVideoFrameKey (not used by audio)
// 4 - kVideoFrameDelta (not used by audio)
uint32_t counter_[5];
uint32_t counter_[3];
};
// TestVadDtx is to verify that VAD/DTX perform as they should. It runs through
@ -64,8 +62,6 @@ class TestVadDtx {
// 0 - kEmptyFrame
// 1 - kAudioFrameSpeech
// 2 - kAudioFrameCN
// 3 - kVideoFrameKey (not used by audio)
// 4 - kVideoFrameDelta (not used by audio)
void Run(std::string in_filename,
int frequency,
int channels,

View File

@ -315,8 +315,8 @@ void OpusTest::Run(TestPackStereo* channel,
}
// Send data to the channel. "channel" will handle the loss simulation.
channel->SendData(kAudioFrameSpeech, payload_type_, rtp_timestamp_,
bitstream, bitstream_len_byte, NULL);
channel->SendData(AudioFrameType::kAudioFrameSpeech, payload_type_,
rtp_timestamp_, bitstream, bitstream_len_byte, NULL);
if (first_packet) {
first_packet = false;
start_time_stamp = rtp_timestamp_;