Commit bdad630a authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #26839: audio: use standard types (not ccrtp types)

parent ddecb937
......@@ -56,9 +56,9 @@ class Alaw : public sfl::AudioCodec {
return buf_size;
}
int ALawDecode(uint8 alaw) {
int ALawDecode(uint8_t alaw) {
alaw ^= 0x55; // A-law has alternate bits inverted for transmission
uint sign = alaw & 0x80;
uint8_t sign = alaw & 0x80;
int linear = alaw & 0x1f;
linear <<= 4;
linear += 8; // Add a 'half' bit (0x08) to place PCM value in middle of range
......@@ -67,7 +67,7 @@ class Alaw : public sfl::AudioCodec {
if (alaw >= 0x20) {
linear |= 0x100; // Put in MSB
uint shift = (alaw >> 4) - 1;
uint8_t shift = (alaw >> 4) - 1;
linear <<= shift;
}
......@@ -77,9 +77,9 @@ class Alaw : public sfl::AudioCodec {
return linear;
}
uint8 ALawEncode(SFLDataFormat pcm16) {
uint8_t ALawEncode(SFLDataFormat pcm16) {
int p = pcm16;
uint a; // u-law value we are forming
uint8_t a; // u-law value we are forming
if (p < 0) {
p = ~p;
......
......@@ -35,7 +35,7 @@ using std::ptrdiff_t;
namespace sfl {
AudioCodec::AudioCodec(uint8 payload, const std::string &codecName,
AudioCodec::AudioCodec(uint8_t payload, const std::string &codecName,
int clockRate, int frameSize, int channel) :
codecName_(codecName),
clockRate_(clockRate),
......@@ -61,7 +61,7 @@ std::string AudioCodec::getMimeSubtype() const
return codecName_;
}
uint8 AudioCodec::getPayloadType() const
uint8_t AudioCodec::getPayloadType() const
{
return payload_;
}
......@@ -71,7 +71,7 @@ bool AudioCodec::hasDynamicPayload() const
return hasDynamicPayload_;
}
uint32 AudioCodec::getClockRate() const
uint32_t AudioCodec::getClockRate() const
{
return clockRate_;
}
......
......@@ -34,7 +34,6 @@
#include <string>
#include "cc_config.h"
#include "sfl_types.h"
#define XSTR(s) STR(s)
......@@ -53,7 +52,7 @@ namespace sfl {
class AudioCodec {
public:
AudioCodec(uint8 payload, const std::string &codecName, int clockRate,
AudioCodec(uint8_t payload, const std::string &codecName, int clockRate,
int frameSize, int channel);
/**
......@@ -79,9 +78,9 @@ class AudioCodec {
*/
virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t buffer_size) = 0;
uint8 getPayloadType() const;
uint8_t getPayloadType() const;
void setPayloadType(uint8 pt) {
void setPayloadType(uint8_t pt) {
payload_ = pt;
}
......@@ -90,7 +89,7 @@ class AudioCodec {
*/
bool hasDynamicPayload() const;
uint32 getClockRate() const;
uint32_t getClockRate() const;
double getBitRate() const;
......@@ -104,10 +103,10 @@ class AudioCodec {
std::string codecName_; // what we put inside sdp
/** Clock rate or sample rate of the codec, in Hz */
uint32 clockRate_;
uint32_t clockRate_;
/** Number of channel 1 = mono, 2 = stereo */
uint8 channel_;
uint8_t channel_;
/** codec frame size in samples*/
unsigned frameSize_;
......@@ -117,7 +116,7 @@ class AudioCodec {
private:
AudioCodec& operator=(const AudioCodec&);
uint8 payload_;
uint8_t payload_;
protected:
bool hasDynamicPayload_;
......
......@@ -55,13 +55,13 @@ class Ulaw : public sfl::AudioCodec {
return buf_size;
}
SFLDataFormat ULawDecode(uint8 ulaw) {
SFLDataFormat ULawDecode(uint8_t ulaw) {
ulaw ^= 0xff; // u-law has all bits inverted for transmission
int linear = ulaw & 0x0f;
linear <<= 3;
linear |= 0x84; // Set MSB (0x80) and a 'half' bit (0x04) to place PCM value in middle of range
uint shift = ulaw >> 4;
uint8_t shift = ulaw >> 4;
shift &= 7;
linear <<= shift;
linear -= 0x84; // Subract uLaw bias
......@@ -72,9 +72,9 @@ class Ulaw : public sfl::AudioCodec {
return linear;
}
uint8 ULawEncode(SFLDataFormat pcm16) {
uint8_t ULawEncode(SFLDataFormat pcm16) {
int p = pcm16;
uint u; // u-law value we are forming
uint8_t u; // u-law value we are forming
if (p < 0) {
p = ~p;
......
......@@ -39,6 +39,7 @@
#include "logger.h"
#include "manager.h"
#include <unistd.h>
#include <cstdlib>
#include <fstream>
......
......@@ -35,6 +35,7 @@
#endif
#include <iostream>
#include <signal.h>
#include <getopt.h>
#include "fileutils.h"
#include "logger.h"
......
......@@ -42,6 +42,7 @@
#include "config/yamlemitter.h"
#include "logger.h"
#include "manager.h"
#include <unistd.h>
#include <pwd.h>
#include <sstream>
#include <algorithm>
......
......@@ -44,6 +44,7 @@
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment