Skip to content

Commit

Permalink
CamelCase for old dataPacket (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Sep 13, 2017
1 parent ee4f012 commit b1cadf7
Show file tree
Hide file tree
Showing 96 changed files with 346 additions and 346 deletions.
4 changes: 2 additions & 2 deletions erizo/src/erizo/DtlsTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ DtlsTransport::DtlsTransport(MediaType med, const std::string &transport_name, c
const IceConfig& iceConfig, std::string username, std::string password,
bool isServer, std::shared_ptr<Worker> worker, std::shared_ptr<IOWorker> io_worker):
Transport(med, transport_name, connection_id, bundle, rtcp_mux, transport_listener, iceConfig, worker, io_worker),
unprotect_packet_{std::make_shared<dataPacket>()},
unprotect_packet_{std::make_shared<DataPacket>()},
readyRtp(false), readyRtcp(false), isServer_(isServer) {
ELOG_DEBUG("%s message: constructor, transportName: %s, isBundle: %d", toLog(), transport_name.c_str(), bundle);
dtlsRtp.reset(new DtlsSocketContext());
Expand Down Expand Up @@ -260,7 +260,7 @@ void DtlsTransport::onDtlsPacket(DtlsSocketContext *ctx, const unsigned char* da
bool is_rtcp = ctx == dtlsRtcp.get();
int component_id = is_rtcp ? 2 : 1;

packetPtr packet = std::make_shared<dataPacket>(component_id, data, len);
packetPtr packet = std::make_shared<DataPacket>(component_id, data, len);

if (is_rtcp) {
rtcp_resender_->scheduleResend(packet);
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/DtlsTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DtlsTransport : dtls::DtlsReceiver, public Transport {

private:
char protectBuf_[5000];
std::shared_ptr<dataPacket> unprotect_packet_;
std::shared_ptr<DataPacket> unprotect_packet_;
boost::scoped_ptr<dtls::DtlsSocketContext> dtlsRtp, dtlsRtcp;
boost::mutex writeMutex_, sessionMutex_;
boost::scoped_ptr<SrtpChannel> srtp_, srtcp_;
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/IceConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef unsigned int uint;
namespace erizo {

// forward declarations
typedef std::shared_ptr<dataPacket> packetPtr;
typedef std::shared_ptr<DataPacket> packetPtr;
class CandidateInfo;
class WebRtcConnection;
class IceConnection;
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/LibNiceConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void LibNiceConnection::onData(unsigned int component_id, char* buf, int len) {
listener = listener_;
}
if (state == IceState::READY) {
packetPtr packet (new dataPacket());
packetPtr packet (new DataPacket());
memcpy(packet->data, buf, len);
packet->comp = component_id;
packet->length = len;
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/LibNiceConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace erizo {
#define NICE_STREAM_DEF_PWD 22 + 1 /* pwd + NULL */

// forward declarations
typedef std::shared_ptr<dataPacket> packetPtr;
typedef std::shared_ptr<DataPacket> packetPtr;
class CandidateInfo;
class WebRtcConnection;

Expand Down
22 changes: 11 additions & 11 deletions erizo/src/erizo/MediaDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ enum packetType {
OTHER_PACKET
};

struct dataPacket {
dataPacket() = default;
struct DataPacket {
DataPacket() = default;

dataPacket(int comp_, const char *data_, int length_, packetType type_, uint64_t received_time_ms_) :
DataPacket(int comp_, const char *data_, int length_, packetType type_, uint64_t received_time_ms_) :
comp{comp_}, length{length_}, type{type_}, received_time_ms{received_time_ms_}, is_keyframe{false},
ending_of_layer_frame{false}, picture_id{-1} {
memcpy(data, data_, length_);
}

dataPacket(int comp_, const char *data_, int length_, packetType type_) :
DataPacket(int comp_, const char *data_, int length_, packetType type_) :
comp{comp_}, length{length_}, type{type_}, received_time_ms{ClockUtils::timePointToMs(clock::now())},
is_keyframe{false}, ending_of_layer_frame{false}, picture_id{-1} {
memcpy(data, data_, length_);
}

dataPacket(int comp_, const unsigned char *data_, int length_) :
DataPacket(int comp_, const unsigned char *data_, int length_) :
comp{comp_}, length{length_}, type{VIDEO_PACKET}, received_time_ms{ClockUtils::timePointToMs(clock::now())},
is_keyframe{false}, ending_of_layer_frame{false}, picture_id{-1} {
memcpy(data, data_, length_);
Expand Down Expand Up @@ -77,11 +77,11 @@ class Monitor {
class FeedbackSink {
public:
virtual ~FeedbackSink() {}
int deliverFeedback(std::shared_ptr<dataPacket> data_packet) {
int deliverFeedback(std::shared_ptr<DataPacket> data_packet) {
return this->deliverFeedback_(data_packet);
}
private:
virtual int deliverFeedback_(std::shared_ptr<dataPacket> data_packet) = 0;
virtual int deliverFeedback_(std::shared_ptr<DataPacket> data_packet) = 0;
};


Expand All @@ -108,10 +108,10 @@ class MediaSink: public virtual Monitor {
FeedbackSource* sink_fb_source_;

public:
int deliverAudioData(std::shared_ptr<dataPacket> data_packet) {
int deliverAudioData(std::shared_ptr<DataPacket> data_packet) {
return this->deliverAudioData_(data_packet);
}
int deliverVideoData(std::shared_ptr<dataPacket> data_packet) {
int deliverVideoData(std::shared_ptr<DataPacket> data_packet) {
return this->deliverVideoData_(data_packet);
}
uint32_t getVideoSinkSSRC() {
Expand Down Expand Up @@ -146,8 +146,8 @@ class MediaSink: public virtual Monitor {
virtual void close() = 0;

private:
virtual int deliverAudioData_(std::shared_ptr<dataPacket> data_packet) = 0;
virtual int deliverVideoData_(std::shared_ptr<dataPacket> data_packet) = 0;
virtual int deliverAudioData_(std::shared_ptr<DataPacket> data_packet) = 0;
virtual int deliverVideoData_(std::shared_ptr<DataPacket> data_packet) = 0;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions erizo/src/erizo/NicerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ int NicerConnection::sendData(unsigned int component_id, const void* buf, int le
if (checkIceState() != IceState::READY) {
return -1;
}
packetPtr packet (new dataPacket());
packetPtr packet (new DataPacket());
memcpy(packet->data, buf, len);
packet->length = len;
nr_ice_peer_ctx *peer = peer_;
Expand Down Expand Up @@ -578,7 +578,7 @@ void NicerConnection::onData(unsigned int component_id, char* buf, int len) {
listener = listener_;
}
if (state == IceState::READY) {
packetPtr packet (new dataPacket());
packetPtr packet (new DataPacket());
memcpy(packet->data, buf, len);
packet->comp = component_id;
packet->length = len;
Expand Down
6 changes: 3 additions & 3 deletions erizo/src/erizo/OneToManyProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace erizo {
OneToManyProcessor::~OneToManyProcessor() {
}

int OneToManyProcessor::deliverAudioData_(std::shared_ptr<dataPacket> audio_packet) {
int OneToManyProcessor::deliverAudioData_(std::shared_ptr<DataPacket> audio_packet) {
if (audio_packet->length <= 0)
return 0;

Expand All @@ -37,7 +37,7 @@ namespace erizo {
return 0;
}

int OneToManyProcessor::deliverVideoData_(std::shared_ptr<dataPacket> video_packet) {
int OneToManyProcessor::deliverVideoData_(std::shared_ptr<DataPacket> video_packet) {
if (video_packet->length <= 0)
return 0;
RtcpHeader* head = reinterpret_cast<RtcpHeader*>(video_packet->data);
Expand Down Expand Up @@ -67,7 +67,7 @@ namespace erizo {
feedbackSink_ = publisher->getFeedbackSink();
}

int OneToManyProcessor::deliverFeedback_(std::shared_ptr<dataPacket> fb_packet) {
int OneToManyProcessor::deliverFeedback_(std::shared_ptr<DataPacket> fb_packet) {
if (feedbackSink_ != nullptr) {
feedbackSink_->deliverFeedback(fb_packet);
}
Expand Down
6 changes: 3 additions & 3 deletions erizo/src/erizo/OneToManyProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class OneToManyProcessor : public MediaSink, public FeedbackSink {
typedef std::shared_ptr<MediaSink> sink_ptr;
FeedbackSink* feedbackSink_;

int deliverAudioData_(std::shared_ptr<dataPacket> audio_packet) override;
int deliverVideoData_(std::shared_ptr<dataPacket> video_packet) override;
int deliverFeedback_(std::shared_ptr<dataPacket> fb_packet) override;
int deliverAudioData_(std::shared_ptr<DataPacket> audio_packet) override;
int deliverVideoData_(std::shared_ptr<DataPacket> video_packet) override;
int deliverFeedback_(std::shared_ptr<DataPacket> fb_packet) override;
std::future<void> deleteAsync(std::shared_ptr<WebRtcConnection> connection);
void closeAll();
};
Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Transport;

class TransportListener {
public:
virtual void onTransportData(std::shared_ptr<dataPacket> packet, Transport *transport) = 0;
virtual void onTransportData(std::shared_ptr<DataPacket> packet, Transport *transport) = 0;
virtual void updateState(TransportState state, Transport *transport) = 0;
virtual void onCandidate(const CandidateInfo& cand, Transport *transport) = 0;
};
Expand Down
28 changes: 14 additions & 14 deletions erizo/src/erizo/WebRtcConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,31 +401,31 @@ void WebRtcConnection::onCandidate(const CandidateInfo& cand, Transport *transpo
}
}

int WebRtcConnection::deliverAudioData_(std::shared_ptr<dataPacket> audio_packet) {
int WebRtcConnection::deliverAudioData_(std::shared_ptr<DataPacket> audio_packet) {
if (bundle_) {
if (videoTransport_.get() != nullptr) {
if (audioEnabled_ == true) {
sendPacketAsync(std::make_shared<dataPacket>(*audio_packet));
sendPacketAsync(std::make_shared<DataPacket>(*audio_packet));
}
}
} else if (audioTransport_.get() != nullptr) {
if (audioEnabled_ == true) {
sendPacketAsync(std::make_shared<dataPacket>(*audio_packet));
sendPacketAsync(std::make_shared<DataPacket>(*audio_packet));
}
}
return audio_packet->length;
}

int WebRtcConnection::deliverVideoData_(std::shared_ptr<dataPacket> video_packet) {
int WebRtcConnection::deliverVideoData_(std::shared_ptr<DataPacket> video_packet) {
if (videoTransport_.get() != nullptr) {
if (videoEnabled_ == true) {
sendPacketAsync(std::make_shared<dataPacket>(*video_packet));
sendPacketAsync(std::make_shared<DataPacket>(*video_packet));
}
}
return video_packet->length;
}

int WebRtcConnection::deliverFeedback_(std::shared_ptr<dataPacket> fb_packet) {
int WebRtcConnection::deliverFeedback_(std::shared_ptr<DataPacket> fb_packet) {
RtcpHeader *chead = reinterpret_cast<RtcpHeader*>(fb_packet->data);
uint32_t recvSSRC = chead->getSourceSSRC();
if (isVideoSourceSSRC(recvSSRC)) {
Expand All @@ -441,7 +441,7 @@ int WebRtcConnection::deliverFeedback_(std::shared_ptr<dataPacket> fb_packet) {
return fb_packet->length;
}

void WebRtcConnection::onTransportData(std::shared_ptr<dataPacket> packet, Transport *transport) {
void WebRtcConnection::onTransportData(std::shared_ptr<DataPacket> packet, Transport *transport) {
if ((audio_sink_ == nullptr && video_sink_ == nullptr && fb_sink_ == nullptr) ||
getCurrentState() != CONN_READY) {
return;
Expand Down Expand Up @@ -473,7 +473,7 @@ void WebRtcConnection::onTransportData(std::shared_ptr<dataPacket> packet, Trans
pipeline_->read(std::move(packet));
}

void WebRtcConnection::read(std::shared_ptr<dataPacket> packet) {
void WebRtcConnection::read(std::shared_ptr<DataPacket> packet) {
char* buf = packet->data;
int len = packet->length;
// PROCESS RTCP
Expand Down Expand Up @@ -538,7 +538,7 @@ int WebRtcConnection::sendPLI() {
thePLI.setLength(2);
char *buf = reinterpret_cast<char*>(&thePLI);
int len = (thePLI.getLength() + 1) * 4;
sendPacketAsync(std::make_shared<dataPacket>(0, buf, len, VIDEO_PACKET));
sendPacketAsync(std::make_shared<DataPacket>(0, buf, len, VIDEO_PACKET));
return len;
}

Expand Down Expand Up @@ -696,14 +696,14 @@ void WebRtcConnection::trackTransportInfo() {
}

// changes the outgoing payload type for in the given data packet
void WebRtcConnection::sendPacketAsync(std::shared_ptr<dataPacket> packet) {
void WebRtcConnection::sendPacketAsync(std::shared_ptr<DataPacket> packet) {
if (!sending_ || getCurrentState() != CONN_READY) {
return;
}
auto conn_ptr = shared_from_this();
if (packet->comp == -1) {
sending_ = false;
auto p = std::make_shared<dataPacket>();
auto p = std::make_shared<DataPacket>();
p->comp = -1;
worker_->task([conn_ptr, p]{
conn_ptr->sendPacket(p);
Expand Down Expand Up @@ -770,7 +770,7 @@ void WebRtcConnection::getJSONStats(std::function<void(std::string)> callback) {
});
}

void WebRtcConnection::changeDeliverPayloadType(dataPacket *dp, packetType type) {
void WebRtcConnection::changeDeliverPayloadType(DataPacket *dp, packetType type) {
RtpHeader* h = reinterpret_cast<RtpHeader*>(dp->data);
RtcpHeader *chead = reinterpret_cast<RtcpHeader*>(dp->data);
if (!chead->isRtcp()) {
Expand Down Expand Up @@ -807,7 +807,7 @@ void WebRtcConnection::parseIncomingPayloadType(char *buf, int len, packetType t
}
}

void WebRtcConnection::write(std::shared_ptr<dataPacket> packet) {
void WebRtcConnection::write(std::shared_ptr<DataPacket> packet) {
Transport *transport = (bundle_ || packet->type == VIDEO_PACKET) ? videoTransport_.get() :
audioTransport_.get();
if (transport == nullptr) {
Expand Down Expand Up @@ -844,7 +844,7 @@ void WebRtcConnection::asyncTask(std::function<void(std::shared_ptr<WebRtcConnec
});
}

void WebRtcConnection::sendPacket(std::shared_ptr<dataPacket> p) {
void WebRtcConnection::sendPacket(std::shared_ptr<DataPacket> p) {
if (!sending_) {
return;
}
Expand Down
22 changes: 11 additions & 11 deletions erizo/src/erizo/WebRtcConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin

void getJSONStats(std::function<void(std::string)> callback);

void onTransportData(std::shared_ptr<dataPacket> packet, Transport *transport) override;
void onTransportData(std::shared_ptr<DataPacket> packet, Transport *transport) override;

void updateState(TransportState state, Transport * transport) override;

void sendPacketAsync(std::shared_ptr<dataPacket> packet);
void sendPacketAsync(std::shared_ptr<DataPacket> packet);

void onCandidate(const CandidateInfo& cand, Transport *transport) override;

Expand All @@ -149,8 +149,8 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin

void setMetadata(std::map<std::string, std::string> metadata);

void read(std::shared_ptr<dataPacket> packet);
void write(std::shared_ptr<dataPacket> packet);
void read(std::shared_ptr<DataPacket> packet);
void write(std::shared_ptr<DataPacket> packet);

void enableHandler(const std::string &name);
void disableHandler(const std::string &name);
Expand All @@ -177,16 +177,16 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin
}

private:
void sendPacket(std::shared_ptr<dataPacket> packet);
int deliverAudioData_(std::shared_ptr<dataPacket> audio_packet) override;
int deliverVideoData_(std::shared_ptr<dataPacket> video_packet) override;
int deliverFeedback_(std::shared_ptr<dataPacket> fb_packet) override;
void sendPacket(std::shared_ptr<DataPacket> packet);
int deliverAudioData_(std::shared_ptr<DataPacket> audio_packet) override;
int deliverVideoData_(std::shared_ptr<DataPacket> video_packet) override;
int deliverFeedback_(std::shared_ptr<DataPacket> fb_packet) override;
void initializePipeline();

// Utils
std::string getJSONCandidate(const std::string& mid, const std::string& sdp);
// changes the outgoing payload type for in the given data packet
void changeDeliverPayloadType(dataPacket *dp, packetType type);
void changeDeliverPayloadType(DataPacket *dp, packetType type);
// parses incoming payload type, replaces occurence in buf
void parseIncomingPayloadType(char *buf, int len, packetType type);
void trackTransportInfo();
Expand Down Expand Up @@ -247,7 +247,7 @@ class PacketReader : public InboundHandler {
return "reader";
}

void read(Context *ctx, std::shared_ptr<dataPacket> packet) override {
void read(Context *ctx, std::shared_ptr<DataPacket> packet) override {
connection_->read(std::move(packet));
}

Expand All @@ -269,7 +269,7 @@ class PacketWriter : public OutboundHandler {
return "writer";
}

void write(Context *ctx, std::shared_ptr<dataPacket> packet) override {
void write(Context *ctx, std::shared_ptr<DataPacket> packet) override {
connection_->write(std::move(packet));
}

Expand Down
4 changes: 2 additions & 2 deletions erizo/src/erizo/media/ExternalInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int ExternalInput::sendPLI() {

void ExternalInput::receiveRtpData(unsigned char* rtpdata, int len) {
if (video_sink_ != nullptr) {
std::shared_ptr<dataPacket> packet = std::make_shared<dataPacket>(0, reinterpret_cast<char*>(rtpdata),
std::shared_ptr<DataPacket> packet = std::make_shared<DataPacket>(0, reinterpret_cast<char*>(rtpdata),
len, VIDEO_PACKET);
video_sink_->deliverVideoData(packet);
}
Expand Down Expand Up @@ -212,7 +212,7 @@ void ExternalInput::receiveLoop() {
lastAudioPts_ = avpacket_.pts;
length = op_->packageAudio(avpacket_.data, avpacket_.size, decodedBuffer_.get(), avpacket_.pts);
if (length > 0) {
std::shared_ptr<dataPacket> packet = std::make_shared<dataPacket>(0,
std::shared_ptr<DataPacket> packet = std::make_shared<DataPacket>(0,
reinterpret_cast<char*>(decodedBuffer_.get()), length, AUDIO_PACKET);
audio_sink_->deliverAudioData(packet);
}
Expand Down
Loading

0 comments on commit b1cadf7

Please sign in to comment.