diff --git a/erizo/src/erizo/DtlsTransport.cpp b/erizo/src/erizo/DtlsTransport.cpp index 53e31e9822..6bf662b061 100644 --- a/erizo/src/erizo/DtlsTransport.cpp +++ b/erizo/src/erizo/DtlsTransport.cpp @@ -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, std::shared_ptr io_worker): Transport(med, transport_name, connection_id, bundle, rtcp_mux, transport_listener, iceConfig, worker, io_worker), - unprotect_packet_{std::make_shared()}, + unprotect_packet_{std::make_shared()}, 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()); @@ -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(component_id, data, len); + packetPtr packet = std::make_shared(component_id, data, len); if (is_rtcp) { rtcp_resender_->scheduleResend(packet); diff --git a/erizo/src/erizo/DtlsTransport.h b/erizo/src/erizo/DtlsTransport.h index 1a2f089de9..e621c48efc 100644 --- a/erizo/src/erizo/DtlsTransport.h +++ b/erizo/src/erizo/DtlsTransport.h @@ -45,7 +45,7 @@ class DtlsTransport : dtls::DtlsReceiver, public Transport { private: char protectBuf_[5000]; - std::shared_ptr unprotect_packet_; + std::shared_ptr unprotect_packet_; boost::scoped_ptr dtlsRtp, dtlsRtcp; boost::mutex writeMutex_, sessionMutex_; boost::scoped_ptr srtp_, srtcp_; diff --git a/erizo/src/erizo/IceConnection.h b/erizo/src/erizo/IceConnection.h index b9c8153ee0..a575e0f6d3 100644 --- a/erizo/src/erizo/IceConnection.h +++ b/erizo/src/erizo/IceConnection.h @@ -26,7 +26,7 @@ typedef unsigned int uint; namespace erizo { // forward declarations -typedef std::shared_ptr packetPtr; +typedef std::shared_ptr packetPtr; class CandidateInfo; class WebRtcConnection; class IceConnection; diff --git a/erizo/src/erizo/LibNiceConnection.cpp b/erizo/src/erizo/LibNiceConnection.cpp index 2e1c021794..b24dc78eae 100644 --- a/erizo/src/erizo/LibNiceConnection.cpp +++ b/erizo/src/erizo/LibNiceConnection.cpp @@ -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; diff --git a/erizo/src/erizo/LibNiceConnection.h b/erizo/src/erizo/LibNiceConnection.h index 48c29c3078..930c5a2137 100644 --- a/erizo/src/erizo/LibNiceConnection.h +++ b/erizo/src/erizo/LibNiceConnection.h @@ -33,7 +33,7 @@ namespace erizo { #define NICE_STREAM_DEF_PWD 22 + 1 /* pwd + NULL */ // forward declarations -typedef std::shared_ptr packetPtr; +typedef std::shared_ptr packetPtr; class CandidateInfo; class WebRtcConnection; diff --git a/erizo/src/erizo/MediaDefinitions.h b/erizo/src/erizo/MediaDefinitions.h index 91352345ba..d253e9a59b 100644 --- a/erizo/src/erizo/MediaDefinitions.h +++ b/erizo/src/erizo/MediaDefinitions.h @@ -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_); @@ -77,11 +77,11 @@ class Monitor { class FeedbackSink { public: virtual ~FeedbackSink() {} - int deliverFeedback(std::shared_ptr data_packet) { + int deliverFeedback(std::shared_ptr data_packet) { return this->deliverFeedback_(data_packet); } private: - virtual int deliverFeedback_(std::shared_ptr data_packet) = 0; + virtual int deliverFeedback_(std::shared_ptr data_packet) = 0; }; @@ -108,10 +108,10 @@ class MediaSink: public virtual Monitor { FeedbackSource* sink_fb_source_; public: - int deliverAudioData(std::shared_ptr data_packet) { + int deliverAudioData(std::shared_ptr data_packet) { return this->deliverAudioData_(data_packet); } - int deliverVideoData(std::shared_ptr data_packet) { + int deliverVideoData(std::shared_ptr data_packet) { return this->deliverVideoData_(data_packet); } uint32_t getVideoSinkSSRC() { @@ -146,8 +146,8 @@ class MediaSink: public virtual Monitor { virtual void close() = 0; private: - virtual int deliverAudioData_(std::shared_ptr data_packet) = 0; - virtual int deliverVideoData_(std::shared_ptr data_packet) = 0; + virtual int deliverAudioData_(std::shared_ptr data_packet) = 0; + virtual int deliverVideoData_(std::shared_ptr data_packet) = 0; }; /** diff --git a/erizo/src/erizo/NicerConnection.cpp b/erizo/src/erizo/NicerConnection.cpp index 09d9d5941f..d6675a28e6 100644 --- a/erizo/src/erizo/NicerConnection.cpp +++ b/erizo/src/erizo/NicerConnection.cpp @@ -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_; @@ -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; diff --git a/erizo/src/erizo/OneToManyProcessor.cpp b/erizo/src/erizo/OneToManyProcessor.cpp index 00a815a6f7..4aa229103a 100644 --- a/erizo/src/erizo/OneToManyProcessor.cpp +++ b/erizo/src/erizo/OneToManyProcessor.cpp @@ -19,7 +19,7 @@ namespace erizo { OneToManyProcessor::~OneToManyProcessor() { } - int OneToManyProcessor::deliverAudioData_(std::shared_ptr audio_packet) { + int OneToManyProcessor::deliverAudioData_(std::shared_ptr audio_packet) { if (audio_packet->length <= 0) return 0; @@ -37,7 +37,7 @@ namespace erizo { return 0; } - int OneToManyProcessor::deliverVideoData_(std::shared_ptr video_packet) { + int OneToManyProcessor::deliverVideoData_(std::shared_ptr video_packet) { if (video_packet->length <= 0) return 0; RtcpHeader* head = reinterpret_cast(video_packet->data); @@ -67,7 +67,7 @@ namespace erizo { feedbackSink_ = publisher->getFeedbackSink(); } - int OneToManyProcessor::deliverFeedback_(std::shared_ptr fb_packet) { + int OneToManyProcessor::deliverFeedback_(std::shared_ptr fb_packet) { if (feedbackSink_ != nullptr) { feedbackSink_->deliverFeedback(fb_packet); } diff --git a/erizo/src/erizo/OneToManyProcessor.h b/erizo/src/erizo/OneToManyProcessor.h index e80397454c..99b634c3ef 100644 --- a/erizo/src/erizo/OneToManyProcessor.h +++ b/erizo/src/erizo/OneToManyProcessor.h @@ -53,9 +53,9 @@ class OneToManyProcessor : public MediaSink, public FeedbackSink { typedef std::shared_ptr sink_ptr; FeedbackSink* feedbackSink_; - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; - int deliverFeedback_(std::shared_ptr fb_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverFeedback_(std::shared_ptr fb_packet) override; std::future deleteAsync(std::shared_ptr connection); void closeAll(); }; diff --git a/erizo/src/erizo/Transport.h b/erizo/src/erizo/Transport.h index 9b98faadcf..0eda8746cb 100644 --- a/erizo/src/erizo/Transport.h +++ b/erizo/src/erizo/Transport.h @@ -21,7 +21,7 @@ class Transport; class TransportListener { public: - virtual void onTransportData(std::shared_ptr packet, Transport *transport) = 0; + virtual void onTransportData(std::shared_ptr packet, Transport *transport) = 0; virtual void updateState(TransportState state, Transport *transport) = 0; virtual void onCandidate(const CandidateInfo& cand, Transport *transport) = 0; }; diff --git a/erizo/src/erizo/WebRtcConnection.cpp b/erizo/src/erizo/WebRtcConnection.cpp index 24ec4c098c..e6f06f36a0 100644 --- a/erizo/src/erizo/WebRtcConnection.cpp +++ b/erizo/src/erizo/WebRtcConnection.cpp @@ -401,31 +401,31 @@ void WebRtcConnection::onCandidate(const CandidateInfo& cand, Transport *transpo } } -int WebRtcConnection::deliverAudioData_(std::shared_ptr audio_packet) { +int WebRtcConnection::deliverAudioData_(std::shared_ptr audio_packet) { if (bundle_) { if (videoTransport_.get() != nullptr) { if (audioEnabled_ == true) { - sendPacketAsync(std::make_shared(*audio_packet)); + sendPacketAsync(std::make_shared(*audio_packet)); } } } else if (audioTransport_.get() != nullptr) { if (audioEnabled_ == true) { - sendPacketAsync(std::make_shared(*audio_packet)); + sendPacketAsync(std::make_shared(*audio_packet)); } } return audio_packet->length; } -int WebRtcConnection::deliverVideoData_(std::shared_ptr video_packet) { +int WebRtcConnection::deliverVideoData_(std::shared_ptr video_packet) { if (videoTransport_.get() != nullptr) { if (videoEnabled_ == true) { - sendPacketAsync(std::make_shared(*video_packet)); + sendPacketAsync(std::make_shared(*video_packet)); } } return video_packet->length; } -int WebRtcConnection::deliverFeedback_(std::shared_ptr fb_packet) { +int WebRtcConnection::deliverFeedback_(std::shared_ptr fb_packet) { RtcpHeader *chead = reinterpret_cast(fb_packet->data); uint32_t recvSSRC = chead->getSourceSSRC(); if (isVideoSourceSSRC(recvSSRC)) { @@ -441,7 +441,7 @@ int WebRtcConnection::deliverFeedback_(std::shared_ptr fb_packet) { return fb_packet->length; } -void WebRtcConnection::onTransportData(std::shared_ptr packet, Transport *transport) { +void WebRtcConnection::onTransportData(std::shared_ptr packet, Transport *transport) { if ((audio_sink_ == nullptr && video_sink_ == nullptr && fb_sink_ == nullptr) || getCurrentState() != CONN_READY) { return; @@ -473,7 +473,7 @@ void WebRtcConnection::onTransportData(std::shared_ptr packet, Trans pipeline_->read(std::move(packet)); } -void WebRtcConnection::read(std::shared_ptr packet) { +void WebRtcConnection::read(std::shared_ptr packet) { char* buf = packet->data; int len = packet->length; // PROCESS RTCP @@ -538,7 +538,7 @@ int WebRtcConnection::sendPLI() { thePLI.setLength(2); char *buf = reinterpret_cast(&thePLI); int len = (thePLI.getLength() + 1) * 4; - sendPacketAsync(std::make_shared(0, buf, len, VIDEO_PACKET)); + sendPacketAsync(std::make_shared(0, buf, len, VIDEO_PACKET)); return len; } @@ -696,14 +696,14 @@ void WebRtcConnection::trackTransportInfo() { } // changes the outgoing payload type for in the given data packet -void WebRtcConnection::sendPacketAsync(std::shared_ptr packet) { +void WebRtcConnection::sendPacketAsync(std::shared_ptr packet) { if (!sending_ || getCurrentState() != CONN_READY) { return; } auto conn_ptr = shared_from_this(); if (packet->comp == -1) { sending_ = false; - auto p = std::make_shared(); + auto p = std::make_shared(); p->comp = -1; worker_->task([conn_ptr, p]{ conn_ptr->sendPacket(p); @@ -770,7 +770,7 @@ void WebRtcConnection::getJSONStats(std::function callback) { }); } -void WebRtcConnection::changeDeliverPayloadType(dataPacket *dp, packetType type) { +void WebRtcConnection::changeDeliverPayloadType(DataPacket *dp, packetType type) { RtpHeader* h = reinterpret_cast(dp->data); RtcpHeader *chead = reinterpret_cast(dp->data); if (!chead->isRtcp()) { @@ -807,7 +807,7 @@ void WebRtcConnection::parseIncomingPayloadType(char *buf, int len, packetType t } } -void WebRtcConnection::write(std::shared_ptr packet) { +void WebRtcConnection::write(std::shared_ptr packet) { Transport *transport = (bundle_ || packet->type == VIDEO_PACKET) ? videoTransport_.get() : audioTransport_.get(); if (transport == nullptr) { @@ -844,7 +844,7 @@ void WebRtcConnection::asyncTask(std::function p) { +void WebRtcConnection::sendPacket(std::shared_ptr p) { if (!sending_) { return; } diff --git a/erizo/src/erizo/WebRtcConnection.h b/erizo/src/erizo/WebRtcConnection.h index 02d8c14721..60b9f07983 100644 --- a/erizo/src/erizo/WebRtcConnection.h +++ b/erizo/src/erizo/WebRtcConnection.h @@ -135,11 +135,11 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin void getJSONStats(std::function callback); - void onTransportData(std::shared_ptr packet, Transport *transport) override; + void onTransportData(std::shared_ptr packet, Transport *transport) override; void updateState(TransportState state, Transport * transport) override; - void sendPacketAsync(std::shared_ptr packet); + void sendPacketAsync(std::shared_ptr packet); void onCandidate(const CandidateInfo& cand, Transport *transport) override; @@ -149,8 +149,8 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin void setMetadata(std::map metadata); - void read(std::shared_ptr packet); - void write(std::shared_ptr packet); + void read(std::shared_ptr packet); + void write(std::shared_ptr packet); void enableHandler(const std::string &name); void disableHandler(const std::string &name); @@ -177,16 +177,16 @@ class WebRtcConnection: public MediaSink, public MediaSource, public FeedbackSin } private: - void sendPacket(std::shared_ptr packet); - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; - int deliverFeedback_(std::shared_ptr fb_packet) override; + void sendPacket(std::shared_ptr packet); + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverFeedback_(std::shared_ptr 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(); @@ -247,7 +247,7 @@ class PacketReader : public InboundHandler { return "reader"; } - void read(Context *ctx, std::shared_ptr packet) override { + void read(Context *ctx, std::shared_ptr packet) override { connection_->read(std::move(packet)); } @@ -269,7 +269,7 @@ class PacketWriter : public OutboundHandler { return "writer"; } - void write(Context *ctx, std::shared_ptr packet) override { + void write(Context *ctx, std::shared_ptr packet) override { connection_->write(std::move(packet)); } diff --git a/erizo/src/erizo/media/ExternalInput.cpp b/erizo/src/erizo/media/ExternalInput.cpp index afa3e6f4bb..9ce99a5c3f 100644 --- a/erizo/src/erizo/media/ExternalInput.cpp +++ b/erizo/src/erizo/media/ExternalInput.cpp @@ -164,7 +164,7 @@ int ExternalInput::sendPLI() { void ExternalInput::receiveRtpData(unsigned char* rtpdata, int len) { if (video_sink_ != nullptr) { - std::shared_ptr packet = std::make_shared(0, reinterpret_cast(rtpdata), + std::shared_ptr packet = std::make_shared(0, reinterpret_cast(rtpdata), len, VIDEO_PACKET); video_sink_->deliverVideoData(packet); } @@ -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 packet = std::make_shared(0, + std::shared_ptr packet = std::make_shared(0, reinterpret_cast(decodedBuffer_.get()), length, AUDIO_PACKET); audio_sink_->deliverAudioData(packet); } diff --git a/erizo/src/erizo/media/ExternalOutput.cpp b/erizo/src/erizo/media/ExternalOutput.cpp index 150852f129..f993941eeb 100644 --- a/erizo/src/erizo/media/ExternalOutput.cpp +++ b/erizo/src/erizo/media/ExternalOutput.cpp @@ -326,14 +326,14 @@ void ExternalOutput::writeVideoData(char* buf, int len) { } } -int ExternalOutput::deliverAudioData_(std::shared_ptr audio_packet) { - std::shared_ptr copied_packet = std::make_shared(*audio_packet); +int ExternalOutput::deliverAudioData_(std::shared_ptr audio_packet) { + std::shared_ptr copied_packet = std::make_shared(*audio_packet); this->queueData(copied_packet->data, copied_packet->length, AUDIO_PACKET); return 0; } -int ExternalOutput::deliverVideoData_(std::shared_ptr video_packet) { - std::shared_ptr copied_packet = std::make_shared(*video_packet); +int ExternalOutput::deliverVideoData_(std::shared_ptr video_packet) { + std::shared_ptr copied_packet = std::make_shared(*video_packet); // TODO(javierc): We should support higher layers, but it requires having an entire pipeline at this point if (!video_packet->belongsToSpatialLayer(0)) { return 0; @@ -486,7 +486,7 @@ int ExternalOutput::sendFirPacket() { thePLI.setLength(2); char *buf = reinterpret_cast(&thePLI); int len = (thePLI.getLength() + 1) * 4; - std::shared_ptr pli_packet = std::make_shared(0, buf, len, VIDEO_PACKET); + std::shared_ptr pli_packet = std::make_shared(0, buf, len, VIDEO_PACKET); fb_sink_->deliverFeedback(pli_packet); return len; } @@ -498,11 +498,11 @@ void ExternalOutput::sendLoop() { boost::unique_lock lock(mtx_); cond_.wait(lock); while (audioQueue_.hasData()) { - boost::shared_ptr audioP = audioQueue_.popPacket(); + boost::shared_ptr audioP = audioQueue_.popPacket(); this->writeAudioData(audioP->data, audioP->length); } while (videoQueue_.hasData()) { - boost::shared_ptr videoP = videoQueue_.popPacket(); + boost::shared_ptr videoP = videoQueue_.popPacket(); this->writeVideoData(videoP->data, videoP->length); } if (!inited_ && first_data_received_ != time_point()) { @@ -512,11 +512,11 @@ void ExternalOutput::sendLoop() { // Since we're bailing, let's completely drain our queues of all data. while (audioQueue_.getSize() > 0) { - boost::shared_ptr audioP = audioQueue_.popPacket(true); // ignore our minimum depth check + boost::shared_ptr audioP = audioQueue_.popPacket(true); // ignore our minimum depth check this->writeAudioData(audioP->data, audioP->length); } while (videoQueue_.getSize() > 0) { - boost::shared_ptr videoP = videoQueue_.popPacket(true); // ignore our minimum depth check + boost::shared_ptr videoP = videoQueue_.popPacket(true); // ignore our minimum depth check this->writeVideoData(videoP->data, videoP->length); } } diff --git a/erizo/src/erizo/media/ExternalOutput.h b/erizo/src/erizo/media/ExternalOutput.h index 25b48a40e7..9f62141978 100644 --- a/erizo/src/erizo/media/ExternalOutput.h +++ b/erizo/src/erizo/media/ExternalOutput.h @@ -102,8 +102,8 @@ class ExternalOutput : public MediaSink, public RawDataReceiver, public Feedback int sendFirPacket(); void queueData(char* buffer, int length, packetType type); void sendLoop(); - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; void writeAudioData(char* buf, int len); void writeVideoData(char* buf, int len); bool bufferCheck(RTPPayloadVP8* payload); diff --git a/erizo/src/erizo/media/MediaProcessor.cpp b/erizo/src/erizo/media/MediaProcessor.cpp index e699b8477a..20ca666afc 100644 --- a/erizo/src/erizo/media/MediaProcessor.cpp +++ b/erizo/src/erizo/media/MediaProcessor.cpp @@ -70,9 +70,9 @@ int InputProcessor::init(const MediaInfo& info, RawDataReceiver* receiver) { return 0; } -int InputProcessor::deliverAudioData_(std::shared_ptr audio_packet) { +int InputProcessor::deliverAudioData_(std::shared_ptr audio_packet) { if (audioDecoder && audioUnpackager) { - std::shared_ptr copied_packet = std::make_shared(*audio_packet); + std::shared_ptr copied_packet = std::make_shared(*audio_packet); ELOG_DEBUG("Decoding audio"); int unp = unpackageAudio((unsigned char*) copied_packet->data, copied_packet->length, unpackagedAudioBuffer_); @@ -87,9 +87,9 @@ int InputProcessor::deliverAudioData_(std::shared_ptr audio_packet) } return 0; } -int InputProcessor::deliverVideoData_(std::shared_ptr video_packet) { +int InputProcessor::deliverVideoData_(std::shared_ptr video_packet) { if (videoUnpackager && videoDecoder) { - std::shared_ptr copied_packet = std::make_shared(*video_packet); + std::shared_ptr copied_packet = std::make_shared(*video_packet); int ret = unpackageVideo(reinterpret_cast(copied_packet->data), copied_packet->length, unpackagedBufferPtr_, &gotUnpackagedFrame_); if (ret < 0) diff --git a/erizo/src/erizo/media/MediaProcessor.h b/erizo/src/erizo/media/MediaProcessor.h index e42bdc69e7..e4571da3b0 100644 --- a/erizo/src/erizo/media/MediaProcessor.h +++ b/erizo/src/erizo/media/MediaProcessor.h @@ -126,8 +126,8 @@ class InputProcessor: public MediaSink { bool initAudioUnpackager(); bool initVideoUnpackager(); - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; int decodeAudio(unsigned char* inBuff, int inBuffLen, unsigned char* outBuff); }; diff --git a/erizo/src/erizo/media/OneToManyTranscoder.cpp b/erizo/src/erizo/media/OneToManyTranscoder.cpp index c3c75dc23f..00b2ebcfb7 100644 --- a/erizo/src/erizo/media/OneToManyTranscoder.cpp +++ b/erizo/src/erizo/media/OneToManyTranscoder.cpp @@ -53,7 +53,7 @@ OneToManyTranscoder::~OneToManyTranscoder() { delete op_; op_ = NULL; } -int OneToManyTranscoder::deliverAudioData_(std::shared_ptr audio_packet) { +int OneToManyTranscoder::deliverAudioData_(std::shared_ptr audio_packet) { if (subscribers.empty() || audio_packet->length <= 0) return 0; @@ -65,7 +65,7 @@ int OneToManyTranscoder::deliverAudioData_(std::shared_ptr audio_pac return 0; } -int OneToManyTranscoder::deliverVideoData_(std::shared_ptr video_packet) { +int OneToManyTranscoder::deliverVideoData_(std::shared_ptr video_packet) { RtpHeader* theHead = reinterpret_cast(video_packet->data); // ELOG_DEBUG("extension %d pt %u", theHead->getExtension(), // theHead->getPayloadType()); @@ -90,7 +90,7 @@ void OneToManyTranscoder::receiveRtpData(unsigned char*rtpdata, int len) { if (subscribers.empty() || len <= 0) return; std::map::iterator it; - std::shared_ptr data_packet = std::make_shared(0, + std::shared_ptr data_packet = std::make_shared(0, reinterpret_cast(rtpdata), len, VIDEO_PACKET); for (it = subscribers.begin(); it != subscribers.end(); it++) { (*it).second->deliverVideoData(data_packet); diff --git a/erizo/src/erizo/media/OneToManyTranscoder.h b/erizo/src/erizo/media/OneToManyTranscoder.h index 23144bf9e5..867acf7e0e 100644 --- a/erizo/src/erizo/media/OneToManyTranscoder.h +++ b/erizo/src/erizo/media/OneToManyTranscoder.h @@ -57,13 +57,13 @@ class OneToManyTranscoder : public MediaSink, public RawDataReceiver, public RTP char sendVideoBuffer_[2000]; char sendAudioBuffer_[2000]; RTPSink* sink_; - std::vector head; + std::vector head; int gotFrame_, gotDecodedFrame_, size_; void sendHead(WebRtcConnection* conn); RtpVP8Parser pars; unsigned int sentPackets_; - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; /** * Closes all the subscribers and the publisher, the object is useless after this */ diff --git a/erizo/src/erizo/media/SyntheticInput.cpp b/erizo/src/erizo/media/SyntheticInput.cpp index 338e4744fc..1c5a733a3f 100644 --- a/erizo/src/erizo/media/SyntheticInput.cpp +++ b/erizo/src/erizo/media/SyntheticInput.cpp @@ -136,7 +136,7 @@ void SyntheticInput::sendVideoframe(bool is_keyframe, bool is_marker, uint32_t s keyframe_requested_ = false; } if (video_sink_) { - video_sink_->deliverVideoData(std::make_shared(0, packet_buffer, size, VIDEO_PACKET)); + video_sink_->deliverVideoData(std::make_shared(0, packet_buffer, size, VIDEO_PACKET)); } delete header; } @@ -152,7 +152,7 @@ void SyntheticInput::sendAudioFrame(uint32_t size) { memset(packet_buffer, 0, size); memcpy(packet_buffer, reinterpret_cast(header), header->getHeaderLength()); if (audio_sink_) { - audio_sink_->deliverAudioData(std::make_shared(0, packet_buffer, size, AUDIO_PACKET)); + audio_sink_->deliverAudioData(std::make_shared(0, packet_buffer, size, AUDIO_PACKET)); } delete header; } @@ -175,7 +175,7 @@ void SyntheticInput::calculateSizeAndPeriod(uint32_t video_bitrate, uint32_t aud audio_frame_size_ = audio_period.count() * audio_bitrate / 8000; } -int SyntheticInput::deliverFeedback_(std::shared_ptr fb_packet) { +int SyntheticInput::deliverFeedback_(std::shared_ptr fb_packet) { RtcpHeader *chead = reinterpret_cast(fb_packet->data); if (chead->isFeedback()) { if (chead->getBlockCount() == 0 && (chead->getLength()+1) * 4 == fb_packet->length) { diff --git a/erizo/src/erizo/media/SyntheticInput.h b/erizo/src/erizo/media/SyntheticInput.h index ba6da23edb..b82f948316 100644 --- a/erizo/src/erizo/media/SyntheticInput.h +++ b/erizo/src/erizo/media/SyntheticInput.h @@ -48,7 +48,7 @@ class SyntheticInput : public MediaSource, public FeedbackSink, public std::enab private: void tick(); void calculateSizeAndPeriod(uint32_t video_bitrate, uint32_t audio_bitrate); - int deliverFeedback_(std::shared_ptr fb_packet) override; + int deliverFeedback_(std::shared_ptr fb_packet) override; void sendVideoframe(bool is_keyframe, bool is_marker, uint32_t size); void sendAudioFrame(uint32_t size); uint32_t getRandomValue(uint32_t average, uint32_t variation); diff --git a/erizo/src/erizo/media/mixers/VideoMixer.cpp b/erizo/src/erizo/media/mixers/VideoMixer.cpp index 9b48107d01..077f2047d6 100644 --- a/erizo/src/erizo/media/mixers/VideoMixer.cpp +++ b/erizo/src/erizo/media/mixers/VideoMixer.cpp @@ -38,11 +38,11 @@ VideoMixer::~VideoMixer() { delete op; op = NULL; } -int VideoMixer::deliverAudioData_(std::shared_ptr audio_packet) { +int VideoMixer::deliverAudioData_(std::shared_ptr audio_packet) { return 0; } -int VideoMixer::deliverVideoData_(std::shared_ptr video_packet) { +int VideoMixer::deliverVideoData_(std::shared_ptr video_packet) { return 0; } diff --git a/erizo/src/erizo/media/mixers/VideoMixer.h b/erizo/src/erizo/media/mixers/VideoMixer.h index b70effee3a..27f0153c5a 100644 --- a/erizo/src/erizo/media/mixers/VideoMixer.h +++ b/erizo/src/erizo/media/mixers/VideoMixer.h @@ -42,8 +42,8 @@ class VideoMixer : public MediaSink, public RawDataReceiver, public RTPDataRecei * @param peerId the peerId */ void removePublisher(int peerSSRC); - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; void receiveRawData(const RawDataPacket& packet) override; void receiveRtpData(unsigned char* rtpdata, int len) override; @@ -62,7 +62,7 @@ class VideoMixer : public MediaSink, public RawDataReceiver, public RTPDataRecei char sendVideoBuffer_[2000]; char sendAudioBuffer_[2000]; RTPSink* sink_; - std::vector head; + std::vector head; int gotFrame_, gotDecodedFrame_, size_; void sendHead(WebRtcConnection* conn); RtpVP8Parser pars; diff --git a/erizo/src/erizo/pipeline/Handler.h b/erizo/src/erizo/pipeline/Handler.h index ba0529c00a..ccee2359aa 100644 --- a/erizo/src/erizo/pipeline/Handler.h +++ b/erizo/src/erizo/pipeline/Handler.h @@ -51,7 +51,7 @@ class Handler : public HandlerBase { virtual void disable() = 0; virtual std::string getName() = 0; - virtual void read(Context* ctx, std::shared_ptr packet) = 0; + virtual void read(Context* ctx, std::shared_ptr packet) = 0; virtual void readEOF(Context* ctx) { ctx->fireReadEOF(); } @@ -62,7 +62,7 @@ class Handler : public HandlerBase { ctx->fireTransportInactive(); } - virtual void write(Context* ctx, std::shared_ptr packet) = 0; + virtual void write(Context* ctx, std::shared_ptr packet) = 0; virtual void close(Context* ctx) { return ctx->fireClose(); } @@ -82,7 +82,7 @@ class InboundHandler : public HandlerBase { virtual std::string getName() = 0; - virtual void read(Context* ctx, std::shared_ptr packet) = 0; + virtual void read(Context* ctx, std::shared_ptr packet) = 0; virtual void readEOF(Context* ctx) { ctx->fireReadEOF(); } @@ -108,7 +108,7 @@ class OutboundHandler : public HandlerBase { virtual std::string getName() = 0; - virtual void write(Context* ctx, std::shared_ptr packet) = 0; + virtual void write(Context* ctx, std::shared_ptr packet) = 0; virtual void close(Context* ctx) { return ctx->fireClose(); } @@ -130,11 +130,11 @@ class HandlerAdapter : public Handler { return "adapter"; } - void read(Context* ctx, std::shared_ptr packet) override { + void read(Context* ctx, std::shared_ptr packet) override { ctx->fireRead(std::move(packet)); } - void write(Context* ctx, std::shared_ptr packet) override { + void write(Context* ctx, std::shared_ptr packet) override { return ctx->fireWrite(std::move(packet)); } diff --git a/erizo/src/erizo/pipeline/HandlerContext-inl.h b/erizo/src/erizo/pipeline/HandlerContext-inl.h index 69aeff14e7..630fbc0c9c 100644 --- a/erizo/src/erizo/pipeline/HandlerContext-inl.h +++ b/erizo/src/erizo/pipeline/HandlerContext-inl.h @@ -44,7 +44,7 @@ class PipelineContext { class InboundLink { public: virtual ~InboundLink() = default; - virtual void read(std::shared_ptr packet) = 0; + virtual void read(std::shared_ptr packet) = 0; virtual void readEOF() = 0; virtual void transportActive() = 0; virtual void transportInactive() = 0; @@ -53,7 +53,7 @@ class InboundLink { class OutboundLink { public: virtual ~OutboundLink() = default; - virtual void write(std::shared_ptr packet) = 0; + virtual void write(std::shared_ptr packet) = 0; virtual void close() = 0; }; @@ -166,7 +166,7 @@ class ContextImpl ~ContextImpl() = default; // HandlerContext overrides - void fireRead(std::shared_ptr packet) override { + void fireRead(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); if (this->nextIn_) { this->nextIn_->read(std::move(packet)); @@ -194,7 +194,7 @@ class ContextImpl } } - void fireWrite(std::shared_ptr packet) override { + void fireWrite(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); if (this->nextOut_) { this->nextOut_->write(std::move(packet)); @@ -217,7 +217,7 @@ class ContextImpl } // InboundLink overrides - void read(std::shared_ptr packet) override { + void read(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); this->handler_->read(this, std::move(packet)); } @@ -238,7 +238,7 @@ class ContextImpl } // OutboundLink overrides - void write(std::shared_ptr packet) override { + void write(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); this->handler_->write(this, std::move(packet)); } @@ -272,7 +272,7 @@ class InboundContextImpl ~InboundContextImpl() = default; // InboundHandlerContext overrides - void fireRead(std::shared_ptr packet) override { + void fireRead(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); if (this->nextIn_) { this->nextIn_->read(std::move(packet)); @@ -309,7 +309,7 @@ class InboundContextImpl } // InboundLink overrides - void read(std::shared_ptr packet) override { + void read(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); this->handler_->read(this, std::move(packet)); } @@ -353,7 +353,7 @@ class OutboundContextImpl ~OutboundContextImpl() = default; // OutboundHandlerContext overrides - void fireWrite(std::shared_ptr packet) override { + void fireWrite(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); if (this->nextOut_) { return this->nextOut_->write(std::move(packet)); @@ -376,7 +376,7 @@ class OutboundContextImpl } // OutboundLink overrides - void write(std::shared_ptr packet) override { + void write(std::shared_ptr packet) override { auto guard = this->pipelineWeak_.lock(); return this->handler_->write(this, std::move(packet)); } diff --git a/erizo/src/erizo/pipeline/HandlerContext.h b/erizo/src/erizo/pipeline/HandlerContext.h index 7b9c7f5000..b03f89cf2f 100644 --- a/erizo/src/erizo/pipeline/HandlerContext.h +++ b/erizo/src/erizo/pipeline/HandlerContext.h @@ -22,12 +22,12 @@ class HandlerContext { public: virtual ~HandlerContext() = default; - virtual void fireRead(std::shared_ptr packet) = 0; + virtual void fireRead(std::shared_ptr packet) = 0; virtual void fireReadEOF() = 0; virtual void fireTransportActive() = 0; virtual void fireTransportInactive() = 0; - virtual void fireWrite(std::shared_ptr packet) = 0; + virtual void fireWrite(std::shared_ptr packet) = 0; virtual void fireClose() = 0; virtual PipelineBase* getPipeline() = 0; @@ -38,7 +38,7 @@ class InboundHandlerContext { public: virtual ~InboundHandlerContext() = default; - virtual void fireRead(std::shared_ptr packet) = 0; + virtual void fireRead(std::shared_ptr packet) = 0; virtual void fireReadEOF() = 0; virtual void fireTransportActive() = 0; virtual void fireTransportInactive() = 0; @@ -51,7 +51,7 @@ class OutboundHandlerContext { public: virtual ~OutboundHandlerContext() = default; - virtual void fireWrite(std::shared_ptr packet) = 0; + virtual void fireWrite(std::shared_ptr packet) = 0; virtual void fireClose() = 0; virtual PipelineBase* getPipeline() = 0; diff --git a/erizo/src/erizo/pipeline/Pipeline.cpp b/erizo/src/erizo/pipeline/Pipeline.cpp index 0c894d4b2b..20649c03be 100644 --- a/erizo/src/erizo/pipeline/Pipeline.cpp +++ b/erizo/src/erizo/pipeline/Pipeline.cpp @@ -65,7 +65,7 @@ Pipeline::~Pipeline() { detachHandlers(); } -void Pipeline::read(std::shared_ptr packet) { +void Pipeline::read(std::shared_ptr packet) { if (!front_) { return; } @@ -79,7 +79,7 @@ void Pipeline::readEOF() { front_->readEOF(); } -void Pipeline::write(std::shared_ptr packet) { +void Pipeline::write(std::shared_ptr packet) { if (!back_) { return; } diff --git a/erizo/src/erizo/pipeline/Pipeline.h b/erizo/src/erizo/pipeline/Pipeline.h index 48a3a15151..5f0e385463 100644 --- a/erizo/src/erizo/pipeline/Pipeline.h +++ b/erizo/src/erizo/pipeline/Pipeline.h @@ -161,7 +161,7 @@ class Pipeline : public PipelineBase { ~Pipeline(); - void read(std::shared_ptr packet); + void read(std::shared_ptr packet); void readEOF(); @@ -169,7 +169,7 @@ class Pipeline : public PipelineBase { void transportInactive(); - void write(std::shared_ptr packet); + void write(std::shared_ptr packet); void close(); diff --git a/erizo/src/erizo/rtp/BandwidthEstimationHandler.cpp b/erizo/src/erizo/rtp/BandwidthEstimationHandler.cpp index 5ad7755b98..d13b1cf669 100644 --- a/erizo/src/erizo/rtp/BandwidthEstimationHandler.cpp +++ b/erizo/src/erizo/rtp/BandwidthEstimationHandler.cpp @@ -139,7 +139,7 @@ void BandwidthEstimationHandler::updateExtensionMap(bool is_video, std::array packet) { +void BandwidthEstimationHandler::read(Context *ctx, std::shared_ptr packet) { if (initialized_ && !running_) { process(); running_ = true; @@ -159,7 +159,7 @@ void BandwidthEstimationHandler::read(Context *ctx, std::shared_ptr ctx->fireRead(std::move(packet)); } -bool BandwidthEstimationHandler::parsePacket(std::shared_ptr packet) { +bool BandwidthEstimationHandler::parsePacket(std::shared_ptr packet) { const uint8_t* buffer = reinterpret_cast(packet->data); size_t length = packet->length; webrtc::RtpUtility::RtpHeaderParser rtp_parser(buffer, length); @@ -168,7 +168,7 @@ bool BandwidthEstimationHandler::parsePacket(std::shared_ptr packet) return rtp_parser.Parse(&header_, &map); } -RtpHeaderExtensionMap BandwidthEstimationHandler::getHeaderExtensionMap(std::shared_ptr packet) const { +RtpHeaderExtensionMap BandwidthEstimationHandler::getHeaderExtensionMap(std::shared_ptr packet) const { RtpHeaderExtensionMap map; switch (packet->type) { case VIDEO_PACKET: @@ -184,7 +184,7 @@ RtpHeaderExtensionMap BandwidthEstimationHandler::getHeaderExtensionMap(std::sha } } -void BandwidthEstimationHandler::write(Context *ctx, std::shared_ptr packet) { +void BandwidthEstimationHandler::write(Context *ctx, std::shared_ptr packet) { ctx->fireWrite(std::move(packet)); } @@ -228,7 +228,7 @@ void BandwidthEstimationHandler::sendREMBPacket() { int remb_length = (remb_packet_.getLength() + 1) * 4; if (active_) { ELOG_DEBUG("BWE Estimation is %d", last_send_bitrate_); - getContext()->fireWrite(std::make_shared(0, + getContext()->fireWrite(std::make_shared(0, reinterpret_cast(&remb_packet_), remb_length, OTHER_PACKET)); } } diff --git a/erizo/src/erizo/rtp/BandwidthEstimationHandler.h b/erizo/src/erizo/rtp/BandwidthEstimationHandler.h index 152b3ca5cd..be3044416a 100644 --- a/erizo/src/erizo/rtp/BandwidthEstimationHandler.h +++ b/erizo/src/erizo/rtp/BandwidthEstimationHandler.h @@ -52,8 +52,8 @@ class BandwidthEstimationHandler: public Handler, public RemoteBitrateObserver, return "bwe"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; void updateExtensionMaps(std::array video_map, std::array audio_map); @@ -61,8 +61,8 @@ class BandwidthEstimationHandler: public Handler, public RemoteBitrateObserver, private: void process(); void sendREMBPacket(); - bool parsePacket(std::shared_ptr packet); - RtpHeaderExtensionMap getHeaderExtensionMap(std::shared_ptr packet) const; + bool parsePacket(std::shared_ptr packet); + RtpHeaderExtensionMap getHeaderExtensionMap(std::shared_ptr packet) const; void pickEstimatorFromHeader(); void pickEstimator(); diff --git a/erizo/src/erizo/rtp/FecReceiverHandler.cpp b/erizo/src/erizo/rtp/FecReceiverHandler.cpp index 2330146e18..8a574275c5 100644 --- a/erizo/src/erizo/rtp/FecReceiverHandler.cpp +++ b/erizo/src/erizo/rtp/FecReceiverHandler.cpp @@ -41,7 +41,7 @@ void FecReceiverHandler::notifyUpdate() { } } -void FecReceiverHandler::write(Context *ctx, std::shared_ptr packet) { +void FecReceiverHandler::write(Context *ctx, std::shared_ptr packet) { if (enabled_ && packet->type == VIDEO_PACKET) { RtpHeader *rtp_header = reinterpret_cast(packet->data); if (rtp_header->getPayloadType() == RED_90000_PT) { @@ -64,7 +64,7 @@ void FecReceiverHandler::write(Context *ctx, std::shared_ptr packet) } bool FecReceiverHandler::OnRecoveredPacket(const uint8_t* rtp_packet, size_t rtp_packet_length) { - getContext()->fireWrite(std::make_shared(0, (char*)rtp_packet, rtp_packet_length, VIDEO_PACKET)); // NOLINT + getContext()->fireWrite(std::make_shared(0, (char*)rtp_packet, rtp_packet_length, VIDEO_PACKET)); // NOLINT return true; } diff --git a/erizo/src/erizo/rtp/FecReceiverHandler.h b/erizo/src/erizo/rtp/FecReceiverHandler.h index d9d6fd1f15..4032b6085b 100644 --- a/erizo/src/erizo/rtp/FecReceiverHandler.h +++ b/erizo/src/erizo/rtp/FecReceiverHandler.h @@ -26,7 +26,7 @@ class FecReceiverHandler: public OutboundHandler, public webrtc::RtpData { return "fec-receiver"; } - void write(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; // webrtc::RtpHeader overrides. diff --git a/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.cpp b/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.cpp index d1a538cdd3..ecb2ef95dc 100644 --- a/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.cpp +++ b/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.cpp @@ -20,7 +20,7 @@ void LayerBitrateCalculationHandler::disable() { enabled_ = false; } -void LayerBitrateCalculationHandler::write(Context *ctx, std::shared_ptr packet) { +void LayerBitrateCalculationHandler::write(Context *ctx, std::shared_ptr packet) { if (!enabled_ || !initialized_) { ctx->fireWrite(std::move(packet)); return; diff --git a/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.h b/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.h index df6431aca7..2535d624d5 100644 --- a/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.h +++ b/erizo/src/erizo/rtp/LayerBitrateCalculationHandler.h @@ -28,7 +28,7 @@ class LayerBitrateCalculationHandler: public OutboundHandler { return "layer_bitrate_calculator"; } - void write(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp index 2367e0cefe..6e187009a9 100644 --- a/erizo/src/erizo/rtp/LayerDetectorHandler.cpp +++ b/erizo/src/erizo/rtp/LayerDetectorHandler.cpp @@ -19,7 +19,7 @@ void LayerDetectorHandler::disable() { enabled_ = false; } -void LayerDetectorHandler::read(Context *ctx, std::shared_ptr packet) { +void LayerDetectorHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (!chead->isRtcp() && enabled_ && packet->type == VIDEO_PACKET) { RtpHeader *rtp_header = reinterpret_cast(packet->data); @@ -44,7 +44,7 @@ int LayerDetectorHandler::getSsrcPosition(uint32_t ssrc) { return -1; } -void LayerDetectorHandler::parseLayerInfoFromVP8(std::shared_ptr packet) { +void LayerDetectorHandler::parseLayerInfoFromVP8(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); unsigned char* start_buffer = reinterpret_cast (packet->data); start_buffer = start_buffer + rtp_header->getHeaderLength(); @@ -79,7 +79,7 @@ void LayerDetectorHandler::parseLayerInfoFromVP8(std::shared_ptr pac delete payload; } -void LayerDetectorHandler::parseLayerInfoFromVP9(std::shared_ptr packet) { +void LayerDetectorHandler::parseLayerInfoFromVP9(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); unsigned char* start_buffer = reinterpret_cast (packet->data); start_buffer = start_buffer + rtp_header->getHeaderLength(); diff --git a/erizo/src/erizo/rtp/LayerDetectorHandler.h b/erizo/src/erizo/rtp/LayerDetectorHandler.h index 5fec45eacd..3b94a98de6 100644 --- a/erizo/src/erizo/rtp/LayerDetectorHandler.h +++ b/erizo/src/erizo/rtp/LayerDetectorHandler.h @@ -32,12 +32,12 @@ class LayerDetectorHandler: public InboundHandler, public std::enable_shared_fro return "layer_detector"; } - void read(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: - void parseLayerInfoFromVP8(std::shared_ptr packet); - void parseLayerInfoFromVP9(std::shared_ptr packet); + void parseLayerInfoFromVP8(std::shared_ptr packet); + void parseLayerInfoFromVP9(std::shared_ptr packet); int getSsrcPosition(uint32_t ssrc); private: diff --git a/erizo/src/erizo/rtp/PacketBufferService.cpp b/erizo/src/erizo/rtp/PacketBufferService.cpp index c7f1d7786c..fb18bd3bf0 100644 --- a/erizo/src/erizo/rtp/PacketBufferService.cpp +++ b/erizo/src/erizo/rtp/PacketBufferService.cpp @@ -7,7 +7,7 @@ PacketBufferService::PacketBufferService(): audio_{kServicePacketBufferSize}, video_{kServicePacketBufferSize} { } -void PacketBufferService::insertPacket(std::shared_ptr packet) { +void PacketBufferService::insertPacket(std::shared_ptr packet) { RtpHeader *head = reinterpret_cast (packet->data); switch (packet->type) { case VIDEO_PACKET: @@ -22,10 +22,10 @@ void PacketBufferService::insertPacket(std::shared_ptr packet) { } } -std::shared_ptr PacketBufferService::getVideoPacket(uint16_t seq_num) { +std::shared_ptr PacketBufferService::getVideoPacket(uint16_t seq_num) { return video_[getIndexInBuffer(seq_num)]; } -std::shared_ptr PacketBufferService::getAudioPacket(uint16_t seq_num) { +std::shared_ptr PacketBufferService::getAudioPacket(uint16_t seq_num) { return audio_[getIndexInBuffer(seq_num)]; } uint16_t PacketBufferService::getIndexInBuffer(uint16_t seq_num) { diff --git a/erizo/src/erizo/rtp/PacketBufferService.h b/erizo/src/erizo/rtp/PacketBufferService.h index 400932547c..f04c3882d3 100644 --- a/erizo/src/erizo/rtp/PacketBufferService.h +++ b/erizo/src/erizo/rtp/PacketBufferService.h @@ -18,17 +18,17 @@ class PacketBufferService: public Service { PacketBufferService(const PacketBufferService&& service); - void insertPacket(std::shared_ptr packet); + void insertPacket(std::shared_ptr packet); - std::shared_ptr getVideoPacket(uint16_t seq_num); - std::shared_ptr getAudioPacket(uint16_t seq_num); + std::shared_ptr getVideoPacket(uint16_t seq_num); + std::shared_ptr getAudioPacket(uint16_t seq_num); private: uint16_t getIndexInBuffer(uint16_t seq_num); private: - std::vector> audio_; - std::vector> video_; + std::vector> audio_; + std::vector> video_; }; } // namespace erizo diff --git a/erizo/src/erizo/rtp/PliPacerHandler.cpp b/erizo/src/erizo/rtp/PliPacerHandler.cpp index 86d0409c5b..faf1cf6aaf 100644 --- a/erizo/src/erizo/rtp/PliPacerHandler.cpp +++ b/erizo/src/erizo/rtp/PliPacerHandler.cpp @@ -33,7 +33,7 @@ void PliPacerHandler::notifyUpdate() { } } -void PliPacerHandler::read(Context *ctx, std::shared_ptr packet) { +void PliPacerHandler::read(Context *ctx, std::shared_ptr packet) { if (enabled_ && packet->is_keyframe) { time_last_keyframe_ = clock_->now(); waiting_for_keyframe_ = false; @@ -73,7 +73,7 @@ void PliPacerHandler::scheduleNextPLI() { }, kMinPLIPeriod); } -void PliPacerHandler::write(Context *ctx, std::shared_ptr packet) { +void PliPacerHandler::write(Context *ctx, std::shared_ptr packet) { if (enabled_ && RtpUtils::isPLI(packet)) { if (waiting_for_keyframe_) { return; diff --git a/erizo/src/erizo/rtp/PliPacerHandler.h b/erizo/src/erizo/rtp/PliPacerHandler.h index 7407421a55..29559dc741 100644 --- a/erizo/src/erizo/rtp/PliPacerHandler.h +++ b/erizo/src/erizo/rtp/PliPacerHandler.h @@ -29,8 +29,8 @@ class PliPacerHandler: public Handler, public std::enable_shared_from_this packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/erizo/rtp/QualityFilterHandler.cpp b/erizo/src/erizo/rtp/QualityFilterHandler.cpp index 3192430f39..306412a6ed 100644 --- a/erizo/src/erizo/rtp/QualityFilterHandler.cpp +++ b/erizo/src/erizo/rtp/QualityFilterHandler.cpp @@ -28,7 +28,7 @@ void QualityFilterHandler::disable() { enabled_ = false; } -void QualityFilterHandler::handleFeedbackPackets(const std::shared_ptr &packet) { +void QualityFilterHandler::handleFeedbackPackets(const std::shared_ptr &packet) { RtpUtils::forEachRRBlock(packet, [this](RtcpHeader *chead) { if (chead->packettype == RTCP_PS_Feedback_PT && (chead->getBlockCount() == RTCP_PLI_FMT || @@ -39,7 +39,7 @@ void QualityFilterHandler::handleFeedbackPackets(const std::shared_ptr packet) { +void QualityFilterHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (chead->isFeedback() && enabled_ && is_scalable_) { handleFeedbackPackets(packet); @@ -74,7 +74,7 @@ void QualityFilterHandler::sendPLI() { getContext()->fireRead(RtpUtils::createPLI(video_sink_ssrc_, video_source_ssrc_)); } -void QualityFilterHandler::changeSpatialLayerOnKeyframeReceived(const std::shared_ptr &packet) { +void QualityFilterHandler::changeSpatialLayerOnKeyframeReceived(const std::shared_ptr &packet) { if (future_spatial_layer_ == -1) { return; } @@ -93,7 +93,7 @@ void QualityFilterHandler::changeSpatialLayerOnKeyframeReceived(const std::share } } -void QualityFilterHandler::detectVideoScalability(const std::shared_ptr &packet) { +void QualityFilterHandler::detectVideoScalability(const std::shared_ptr &packet) { if (is_scalable_ || packet->type != VIDEO_PACKET) { return; } @@ -103,7 +103,7 @@ void QualityFilterHandler::detectVideoScalability(const std::shared_ptr &packet) { +void QualityFilterHandler::updatePictureID(const std::shared_ptr &packet) { if (packet->codec == "VP8") { RtpHeader *rtp_header = reinterpret_cast(packet->data); unsigned char* start_buffer = reinterpret_cast (packet->data); @@ -112,7 +112,7 @@ void QualityFilterHandler::updatePictureID(const std::shared_ptr &pa } } -void QualityFilterHandler::write(Context *ctx, std::shared_ptr packet) { +void QualityFilterHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); detectVideoScalability(packet); diff --git a/erizo/src/erizo/rtp/QualityFilterHandler.h b/erizo/src/erizo/rtp/QualityFilterHandler.h index 239ee111e2..7267e0f7f3 100644 --- a/erizo/src/erizo/rtp/QualityFilterHandler.h +++ b/erizo/src/erizo/rtp/QualityFilterHandler.h @@ -30,18 +30,18 @@ class QualityFilterHandler: public Handler, public std::enable_shared_from_this< return "quality_filter"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: void sendPLI(); void checkLayers(); - void handleFeedbackPackets(const std::shared_ptr &packet); + void handleFeedbackPackets(const std::shared_ptr &packet); bool checkSSRCChange(uint32_t ssrc); - void changeSpatialLayerOnKeyframeReceived(const std::shared_ptr &packet); - void detectVideoScalability(const std::shared_ptr &packet); - void updatePictureID(const std::shared_ptr &packet); + void changeSpatialLayerOnKeyframeReceived(const std::shared_ptr &packet); + void detectVideoScalability(const std::shared_ptr &packet); + void updatePictureID(const std::shared_ptr &packet); private: std::shared_ptr quality_manager_; diff --git a/erizo/src/erizo/rtp/RtcpAggregator.cpp b/erizo/src/erizo/rtp/RtcpAggregator.cpp index d8a311190f..59eb908525 100644 --- a/erizo/src/erizo/rtp/RtcpAggregator.cpp +++ b/erizo/src/erizo/rtp/RtcpAggregator.cpp @@ -336,10 +336,10 @@ void RtcpAggregator::checkRtcpFb() { } } if (rtcpSource_->isVideoSourceSSRC(sourceSsrc)) { - rtcpSink_->deliverVideoData(std::make_shared(0, reinterpret_cast(packet_), + rtcpSink_->deliverVideoData(std::make_shared(0, reinterpret_cast(packet_), length, VIDEO_PACKET)); } else { - rtcpSink_->deliverAudioData(std::make_shared(0, reinterpret_cast(packet_), + rtcpSink_->deliverAudioData(std::make_shared(0, reinterpret_cast(packet_), length, AUDIO_PACKET)); } rtcpData->last_rr_sent = now; diff --git a/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.cpp b/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.cpp index cee3765998..2ea893207d 100644 --- a/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.cpp +++ b/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.cpp @@ -17,7 +17,7 @@ void RtcpFeedbackGenerationHandler::disable() { enabled_ = false; } -void RtcpFeedbackGenerationHandler::read(Context *ctx, std::shared_ptr packet) { +void RtcpFeedbackGenerationHandler::read(Context *ctx, std::shared_ptr packet) { // Pass packets to RR and NACK Generator RtcpHeader *chead = reinterpret_cast(packet->data); @@ -55,7 +55,7 @@ void RtcpFeedbackGenerationHandler::read(Context *ctx, std::shared_ptr rtcp_packet = generator_it->second->rr_generator->generateReceiverReport(); + std::shared_ptr rtcp_packet = generator_it->second->rr_generator->generateReceiverReport(); if (nacks_enabled_ && generator_it->second->nack_generator != nullptr) { generator_it->second->nack_generator->addNackPacketToRr(rtcp_packet); } @@ -65,7 +65,7 @@ void RtcpFeedbackGenerationHandler::read(Context *ctx, std::shared_ptrfireRead(std::move(packet)); } -void RtcpFeedbackGenerationHandler::write(Context *ctx, std::shared_ptr packet) { +void RtcpFeedbackGenerationHandler::write(Context *ctx, std::shared_ptr packet) { ctx->fireWrite(std::move(packet)); } diff --git a/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.h b/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.h index 88fcb036e3..9676d783fe 100644 --- a/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.h +++ b/erizo/src/erizo/rtp/RtcpFeedbackGenerationHandler.h @@ -40,8 +40,8 @@ class RtcpFeedbackGenerationHandler: public Handler { return "rtcp_feedback_generation"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/erizo/rtp/RtcpNackGenerator.cpp b/erizo/src/erizo/rtp/RtcpNackGenerator.cpp index 3d4bbc2119..dbcc95a3ff 100644 --- a/erizo/src/erizo/rtp/RtcpNackGenerator.cpp +++ b/erizo/src/erizo/rtp/RtcpNackGenerator.cpp @@ -15,7 +15,7 @@ static const int kNackCommonHeaderLengthRtcp = kNackCommonHeaderLengthBytes/4 - RtcpNackGenerator::RtcpNackGenerator(uint32_t ssrc, std::shared_ptr the_clock) : initialized_{false}, highest_seq_num_{0}, ssrc_{ssrc}, clock_{the_clock} {} -bool RtcpNackGenerator::handleRtpPacket(std::shared_ptr packet) { +bool RtcpNackGenerator::handleRtpPacket(std::shared_ptr packet) { if (packet->type != VIDEO_PACKET) { return false; } @@ -64,7 +64,7 @@ bool RtcpNackGenerator::addNacks(uint16_t seq_num) { return !nack_info_list_.empty(); } -bool RtcpNackGenerator::addNackPacketToRr(std::shared_ptr rr_packet) { +bool RtcpNackGenerator::addNackPacketToRr(std::shared_ptr rr_packet) { // Goes through the list adds blocks of 16 in compound packets (adds more PID/BLP blocks) max is 10 blocks // Only does it if it's time (> 100 ms since last NACK) std::vector nack_vector; diff --git a/erizo/src/erizo/rtp/RtcpNackGenerator.h b/erizo/src/erizo/rtp/RtcpNackGenerator.h index 10b59e9d57..42980a642f 100644 --- a/erizo/src/erizo/rtp/RtcpNackGenerator.h +++ b/erizo/src/erizo/rtp/RtcpNackGenerator.h @@ -31,8 +31,8 @@ class RtcpNackGenerator{ public: explicit RtcpNackGenerator(uint32_t ssrc_, std::shared_ptr the_clock = std::make_shared()); - bool handleRtpPacket(std::shared_ptr packet); - bool addNackPacketToRr(std::shared_ptr rr_packet); + bool handleRtpPacket(std::shared_ptr packet); + bool addNackPacketToRr(std::shared_ptr rr_packet); private: bool addNacks(uint16_t seq_num); diff --git a/erizo/src/erizo/rtp/RtcpProcessorHandler.cpp b/erizo/src/erizo/rtp/RtcpProcessorHandler.cpp index ac6f37facf..7cf6ac941b 100644 --- a/erizo/src/erizo/rtp/RtcpProcessorHandler.cpp +++ b/erizo/src/erizo/rtp/RtcpProcessorHandler.cpp @@ -15,7 +15,7 @@ void RtcpProcessorHandler::enable() { void RtcpProcessorHandler::disable() { } -void RtcpProcessorHandler::read(Context *ctx, std::shared_ptr packet) { +void RtcpProcessorHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast (packet->data); if (chead->isRtcp()) { if (chead->packettype == RTCP_Sender_PT) { // Sender Report @@ -30,7 +30,7 @@ void RtcpProcessorHandler::read(Context *ctx, std::shared_ptr packet ctx->fireRead(std::move(packet)); } -void RtcpProcessorHandler::write(Context *ctx, std::shared_ptr packet) { +void RtcpProcessorHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (chead->isFeedback()) { int length = processor_->analyzeFeedback(packet->data, packet->length); diff --git a/erizo/src/erizo/rtp/RtcpProcessorHandler.h b/erizo/src/erizo/rtp/RtcpProcessorHandler.h index 2947abb92a..40caea3aec 100644 --- a/erizo/src/erizo/rtp/RtcpProcessorHandler.h +++ b/erizo/src/erizo/rtp/RtcpProcessorHandler.h @@ -25,8 +25,8 @@ class RtcpProcessorHandler: public Handler { return "rtcp-processor"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/erizo/rtp/RtcpRrGenerator.cpp b/erizo/src/erizo/rtp/RtcpRrGenerator.cpp index 189898f611..cfb6cf9248 100644 --- a/erizo/src/erizo/rtp/RtcpRrGenerator.cpp +++ b/erizo/src/erizo/rtp/RtcpRrGenerator.cpp @@ -16,7 +16,7 @@ RtcpRrGenerator::RtcpRrGenerator(const RtcpRrGenerator&& generator) : // NOLINT ssrc_{generator.ssrc_}, type_{generator.type_} {} -bool RtcpRrGenerator::isRetransmitOfOldPacket(std::shared_ptr packet) { +bool RtcpRrGenerator::isRetransmitOfOldPacket(std::shared_ptr packet) { RtpHeader *head = reinterpret_cast(packet->data); if (!RtpUtils::sequenceNumberLessThan(head->getSeqNumber(), rr_info_.max_seq) || rr_info_.jitter.jitter == 0) { return false; @@ -44,7 +44,7 @@ int RtcpRrGenerator::getVideoClockRate(uint8_t payload_type) { return 90; } -bool RtcpRrGenerator::handleRtpPacket(std::shared_ptr packet) { +bool RtcpRrGenerator::handleRtpPacket(std::shared_ptr packet) { RtpHeader *head = reinterpret_cast(packet->data); if (ssrc_ != head->getSSRC()) { ELOG_DEBUG("message: handleRtpPacket ssrc not found, ssrc: %u", head->getSSRC()); @@ -93,7 +93,7 @@ bool RtcpRrGenerator::handleRtpPacket(std::shared_ptr packet) { return false; } -std::shared_ptr RtcpRrGenerator::generateReceiverReport() { +std::shared_ptr RtcpRrGenerator::generateReceiverReport() { uint64_t now = ClockUtils::timePointToMs(clock_->now()); uint64_t delay_since_last_sr = rr_info_.last_sr_ts == 0 ? 0 : (now - rr_info_.last_sr_ts) * 65536 / 1000; @@ -144,11 +144,11 @@ std::shared_ptr RtcpRrGenerator::generateReceiverReport() { uint16_t selected_interval = selectInterval(); rr_info_.next_packet_ms = now + getRandomValue(0.5 * selected_interval, 1.5 * selected_interval); rr_info_.last_packet_ms = now; - return (std::make_shared(0, reinterpret_cast(&packet_), length, type_)); + return (std::make_shared(0, reinterpret_cast(&packet_), length, type_)); } -void RtcpRrGenerator::handleSr(std::shared_ptr packet) { +void RtcpRrGenerator::handleSr(std::shared_ptr packet) { RtcpHeader* chead = reinterpret_cast(packet->data); if (ssrc_ != chead->getSSRC()) { ELOG_DEBUG("message: handleRtpPacket ssrc not found, ssrc: %u", chead->getSSRC()); diff --git a/erizo/src/erizo/rtp/RtcpRrGenerator.h b/erizo/src/erizo/rtp/RtcpRrGenerator.h index cf6b087b50..583663b22b 100644 --- a/erizo/src/erizo/rtp/RtcpRrGenerator.h +++ b/erizo/src/erizo/rtp/RtcpRrGenerator.h @@ -26,12 +26,12 @@ class RtcpRrGenerator { std::shared_ptr the_clock = std::make_shared()); explicit RtcpRrGenerator(const RtcpRrGenerator&& handler); // NOLINT - bool handleRtpPacket(std::shared_ptr packet); - void handleSr(std::shared_ptr packet); - std::shared_ptr generateReceiverReport(); + bool handleRtpPacket(std::shared_ptr packet); + void handleSr(std::shared_ptr packet); + std::shared_ptr generateReceiverReport(); private: - bool isRetransmitOfOldPacket(std::shared_ptr packet); + bool isRetransmitOfOldPacket(std::shared_ptr packet); int getAudioClockRate(uint8_t payload_type); int getVideoClockRate(uint8_t payload_type); uint16_t selectInterval(); diff --git a/erizo/src/erizo/rtp/RtpExtensionProcessor.cpp b/erizo/src/erizo/rtp/RtpExtensionProcessor.cpp index 85a42475d4..7d1b8e4d3f 100644 --- a/erizo/src/erizo/rtp/RtpExtensionProcessor.cpp +++ b/erizo/src/erizo/rtp/RtpExtensionProcessor.cpp @@ -63,7 +63,7 @@ bool RtpExtensionProcessor::isValidExtension(std::string uri) { return value != ext_mappings_.end() && translationMap_.find(uri) != translationMap_.end(); } -uint32_t RtpExtensionProcessor::processRtpExtensions(std::shared_ptr p) { +uint32_t RtpExtensionProcessor::processRtpExtensions(std::shared_ptr p) { const RtpHeader* head = reinterpret_cast(p->data); uint32_t len = p->length; std::array extMap; diff --git a/erizo/src/erizo/rtp/RtpExtensionProcessor.h b/erizo/src/erizo/rtp/RtpExtensionProcessor.h index bb385102a1..0042ca8c82 100644 --- a/erizo/src/erizo/rtp/RtpExtensionProcessor.h +++ b/erizo/src/erizo/rtp/RtpExtensionProcessor.h @@ -31,7 +31,7 @@ class RtpExtensionProcessor{ virtual ~RtpExtensionProcessor(); void setSdpInfo(const SdpInfo& theInfo); - uint32_t processRtpExtensions(std::shared_ptr p); + uint32_t processRtpExtensions(std::shared_ptr p); std::array getVideoExtensionMap() { return ext_map_video_; diff --git a/erizo/src/erizo/rtp/RtpPacketQueue.cpp b/erizo/src/erizo/rtp/RtpPacketQueue.cpp index 37d03e59d9..c120a64a36 100644 --- a/erizo/src/erizo/rtp/RtpPacketQueue.cpp +++ b/erizo/src/erizo/rtp/RtpPacketQueue.cpp @@ -42,15 +42,15 @@ void RtpPacketQueue::pushPacket(const char *data, int length) { return; } - // TODO(pedro) this should be a secret of the dataPacket class. It should maintain its own memory + // TODO(pedro) this should be a secret of the DataPacket class. It should maintain its own memory // and copy stuff as necessary. - boost::shared_ptr packet(new dataPacket()); + boost::shared_ptr packet(new DataPacket()); memcpy(packet->data, data, length); packet->length = length; // let's insert this packet where it belongs in the queue. boost::mutex::scoped_lock lock(queueMutex_); - std::list >::iterator it; + std::list >::iterator it; for (it=queue_.begin(); it != queue_.end(); ++it) { const RtpHeader *header = reinterpret_cast((*it)->data); uint16_t sequenceNumber = header->getSeqNumber(); @@ -80,8 +80,8 @@ void RtpPacketQueue::pushPacket(const char *data, int length) { } // pops a packet off the queue, respecting the specified queue depth. -boost::shared_ptr RtpPacketQueue::popPacket(bool ignore_depth) { - boost::shared_ptr packet; +boost::shared_ptr RtpPacketQueue::popPacket(bool ignore_depth) { + boost::shared_ptr packet; boost::mutex::scoped_lock lock(queueMutex_); if (queue_.size() > 0) { diff --git a/erizo/src/erizo/rtp/RtpPacketQueue.h b/erizo/src/erizo/rtp/RtpPacketQueue.h index b431e66e14..3a2b3455f1 100644 --- a/erizo/src/erizo/rtp/RtpPacketQueue.h +++ b/erizo/src/erizo/rtp/RtpPacketQueue.h @@ -10,7 +10,7 @@ namespace erizo { // forward declaration -struct dataPacket; +struct DataPacket; static const double DEFAULT_DEPTH = 3.0; static const double DEFAULT_MAX = 5.0; @@ -45,7 +45,7 @@ class RtpPacketQueue { ~RtpPacketQueue(void); void setTimebase(unsigned int timebase); void pushPacket(const char *data, int length); - boost::shared_ptr popPacket(bool ignore_depth = false); + boost::shared_ptr popPacket(bool ignore_depth = false); int getSize(); // total size of all items in the queue bool hasData(); // whether or not current queue depth is >= depth_ @@ -55,7 +55,7 @@ class RtpPacketQueue { double getDepthInSeconds(); boost::mutex queueMutex_; - std::list > queue_; + std::list > queue_; int lastSequenceNumberGiven_; bool rtpSequenceLessThan(uint16_t x, uint16_t y); diff --git a/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.cpp b/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.cpp index ea5d571c17..2b1cf053b3 100644 --- a/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.cpp +++ b/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.cpp @@ -61,11 +61,11 @@ void RtpPaddingGeneratorHandler::notifyUpdate() { } } -void RtpPaddingGeneratorHandler::read(Context *ctx, std::shared_ptr packet) { +void RtpPaddingGeneratorHandler::read(Context *ctx, std::shared_ptr packet) { ctx->fireRead(std::move(packet)); } -void RtpPaddingGeneratorHandler::write(Context *ctx, std::shared_ptr packet) { +void RtpPaddingGeneratorHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); bool is_higher_sequence_number = false; if (packet->type == VIDEO_PACKET && !chead->isRtcp()) { @@ -84,7 +84,7 @@ void RtpPaddingGeneratorHandler::write(Context *ctx, std::shared_ptr } } -void RtpPaddingGeneratorHandler::sendPaddingPacket(std::shared_ptr packet, uint8_t padding_size) { +void RtpPaddingGeneratorHandler::sendPaddingPacket(std::shared_ptr packet, uint8_t padding_size) { if (padding_size == 0) { return; } @@ -104,7 +104,7 @@ void RtpPaddingGeneratorHandler::sendPaddingPacket(std::shared_ptr p getContext()->fireWrite(std::move(padding_packet)); } -void RtpPaddingGeneratorHandler::onPacketWithMarkerSet(std::shared_ptr packet) { +void RtpPaddingGeneratorHandler::onPacketWithMarkerSet(std::shared_ptr packet) { marker_rate_++; for (uint i = 0; i < number_of_full_padding_packets_; i++) { @@ -119,7 +119,7 @@ void RtpPaddingGeneratorHandler::onPacketWithMarkerSet(std::shared_ptr packet) { +bool RtpPaddingGeneratorHandler::isHigherSequenceNumber(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); rtp_header_length_ = rtp_header->getHeaderLength(); uint16_t new_sequence_number = rtp_header->getSeqNumber(); @@ -132,7 +132,7 @@ bool RtpPaddingGeneratorHandler::isHigherSequenceNumber(std::shared_ptr packet) { +void RtpPaddingGeneratorHandler::onVideoPacket(std::shared_ptr packet) { if (!enabled_) { return; } diff --git a/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.h b/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.h index 1cd138259b..4ac3bf3631 100644 --- a/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.h +++ b/erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.h @@ -28,15 +28,15 @@ class RtpPaddingGeneratorHandler: public Handler, public std::enable_shared_from return "padding-generator"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: - void sendPaddingPacket(std::shared_ptr packet, uint8_t padding_size); - void onPacketWithMarkerSet(std::shared_ptr packet); - bool isHigherSequenceNumber(std::shared_ptr packet); - void onVideoPacket(std::shared_ptr packet); + void sendPaddingPacket(std::shared_ptr packet, uint8_t padding_size); + void onPacketWithMarkerSet(std::shared_ptr packet); + bool isHigherSequenceNumber(std::shared_ptr packet); + void onVideoPacket(std::shared_ptr packet); uint64_t getStat(std::string stat_name); uint64_t getTargetBitrate(); diff --git a/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.cpp b/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.cpp index 21cf8374a9..e878a0fa58 100644 --- a/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.cpp +++ b/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.cpp @@ -16,7 +16,7 @@ void RtpPaddingRemovalHandler::disable() { enabled_ = false; } -void RtpPaddingRemovalHandler::read(Context *ctx, std::shared_ptr packet) { +void RtpPaddingRemovalHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); RtpHeader *rtp_header = reinterpret_cast(packet->data); @@ -40,7 +40,7 @@ void RtpPaddingRemovalHandler::read(Context *ctx, std::shared_ptr pa ctx->fireRead(std::move(packet)); } -void RtpPaddingRemovalHandler::write(Context *ctx, std::shared_ptr packet) { +void RtpPaddingRemovalHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader* rtcp_head = reinterpret_cast(packet->data); if (!enabled_ || packet->type != VIDEO_PACKET || !rtcp_head->isFeedback()) { ctx->fireWrite(std::move(packet)); @@ -86,7 +86,7 @@ void RtpPaddingRemovalHandler::write(Context *ctx, std::shared_ptr p ctx->fireWrite(std::move(packet)); } -bool RtpPaddingRemovalHandler::removePaddingBytes(std::shared_ptr packet, +bool RtpPaddingRemovalHandler::removePaddingBytes(std::shared_ptr packet, std::shared_ptr translator) { RtpHeader *rtp_header = reinterpret_cast(packet->data); int header_length = rtp_header->getHeaderLength(); diff --git a/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.h b/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.h index b5a54eae52..2847440e77 100644 --- a/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.h +++ b/erizo/src/erizo/rtp/RtpPaddingRemovalHandler.h @@ -27,12 +27,12 @@ class RtpPaddingRemovalHandler: public Handler, public std::enable_shared_from_t return "padding_removal"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: - bool removePaddingBytes(std::shared_ptr packet, + bool removePaddingBytes(std::shared_ptr packet, std::shared_ptr translator); std::shared_ptr getTranslatorForSsrc(uint32_t ssrc, bool should_create); diff --git a/erizo/src/erizo/rtp/RtpRetransmissionHandler.cpp b/erizo/src/erizo/rtp/RtpRetransmissionHandler.cpp index 9af5f8cbbc..47ea1982e2 100644 --- a/erizo/src/erizo/rtp/RtpRetransmissionHandler.cpp +++ b/erizo/src/erizo/rtp/RtpRetransmissionHandler.cpp @@ -61,7 +61,7 @@ void RtpRetransmissionHandler::calculateRtxBitrate() { } } -void RtpRetransmissionHandler::read(Context *ctx, std::shared_ptr packet) { +void RtpRetransmissionHandler::read(Context *ctx, std::shared_ptr packet) { if (!enabled_ || !initialized_) { return; } @@ -84,7 +84,7 @@ void RtpRetransmissionHandler::read(Context *ctx, std::shared_ptr pa bool packet_nacked = i == -1 || (plb >> i) & 0x0001; if (packet_nacked) { - std::shared_ptr recovered; + std::shared_ptr recovered; if (connection_->getVideoSinkSSRC() == chead->getSourceSSRC()) { recovered = packet_buffer_->getVideoPacket(seq_num); @@ -115,7 +115,7 @@ void RtpRetransmissionHandler::read(Context *ctx, std::shared_ptr pa } } -void RtpRetransmissionHandler::write(Context *ctx, std::shared_ptr packet) { +void RtpRetransmissionHandler::write(Context *ctx, std::shared_ptr packet) { if (!initialized_) { return; } diff --git a/erizo/src/erizo/rtp/RtpRetransmissionHandler.h b/erizo/src/erizo/rtp/RtpRetransmissionHandler.h index 5f6fbd794e..396d71f048 100644 --- a/erizo/src/erizo/rtp/RtpRetransmissionHandler.h +++ b/erizo/src/erizo/rtp/RtpRetransmissionHandler.h @@ -32,8 +32,8 @@ class RtpRetransmissionHandler : public Handler { return "retransmissions"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/erizo/rtp/RtpSink.cpp b/erizo/src/erizo/rtp/RtpSink.cpp index 83be0b53e0..4fbf572750 100644 --- a/erizo/src/erizo/rtp/RtpSink.cpp +++ b/erizo/src/erizo/rtp/RtpSink.cpp @@ -38,12 +38,12 @@ namespace erizo { receive_Thread_.join(); } - int RtpSink::deliverVideoData_(std::shared_ptr video_packet) { + int RtpSink::deliverVideoData_(std::shared_ptr video_packet) { this->queueData(video_packet->data, video_packet->length, VIDEO_PACKET); return 0; } - int RtpSink::deliverAudioData_(std::shared_ptr audio_packet) { + int RtpSink::deliverAudioData_(std::shared_ptr audio_packet) { this->queueData(audio_packet->data, audio_packet->length, AUDIO_PACKET); return 0; } @@ -58,7 +58,7 @@ namespace erizo { if (sending_ == false) return; if (sendQueue_.size() < 1000) { - dataPacket p_; + DataPacket p_; memcpy(p_.data, buffer, len); p_.type = type; p_.length = len; @@ -89,7 +89,7 @@ namespace erizo { void RtpSink::handleReceive(const::boost::system::error_code& error, size_t bytes_recvd) { // NOLINT if (bytes_recvd > 0 && fb_sink_) { - fb_sink_->deliverFeedback(std::make_shared(0, reinterpret_cast(buffer_), + fb_sink_->deliverFeedback(std::make_shared(0, reinterpret_cast(buffer_), static_cast(bytes_recvd), OTHER_PACKET)); } } diff --git a/erizo/src/erizo/rtp/RtpSink.h b/erizo/src/erizo/rtp/RtpSink.h index c597a8fad7..f474db1292 100644 --- a/erizo/src/erizo/rtp/RtpSink.h +++ b/erizo/src/erizo/rtp/RtpSink.h @@ -38,14 +38,14 @@ class RtpSink: public MediaSink, public FeedbackSource { boost::thread send_Thread_, receive_Thread_; boost::condition_variable cond_; boost::mutex queueMutex_; - std::queue sendQueue_; + std::queue sendQueue_; bool sending_; static const int LENGTH = 1500; char* buffer_[LENGTH]; - int deliverAudioData_(std::shared_ptr audio_packet) override; - int deliverVideoData_(std::shared_ptr video_packet) override; + int deliverAudioData_(std::shared_ptr audio_packet) override; + int deliverVideoData_(std::shared_ptr video_packet) override; int sendData(char* buffer, int len); void sendLoop(); void serviceLoop(); diff --git a/erizo/src/erizo/rtp/RtpSlideShowHandler.cpp b/erizo/src/erizo/rtp/RtpSlideShowHandler.cpp index f68d222d46..e240774f37 100644 --- a/erizo/src/erizo/rtp/RtpSlideShowHandler.cpp +++ b/erizo/src/erizo/rtp/RtpSlideShowHandler.cpp @@ -44,7 +44,7 @@ void RtpSlideShowHandler::notifyUpdate() { setSlideShowMode(fallback_slideshow_enabled || manual_slideshow_enabled); } -void RtpSlideShowHandler::read(Context *ctx, std::shared_ptr packet) { +void RtpSlideShowHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (connection_->getVideoSinkSSRC() != chead->getSourceSSRC()) { ctx->fireRead(std::move(packet)); @@ -81,7 +81,7 @@ void RtpSlideShowHandler::read(Context *ctx, std::shared_ptr packet) ctx->fireRead(std::move(packet)); } -void RtpSlideShowHandler::write(Context *ctx, std::shared_ptr packet) { +void RtpSlideShowHandler::write(Context *ctx, std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); RtcpHeader *rtcp_header = reinterpret_cast(packet->data); if (packet->type != VIDEO_PACKET || rtcp_header->isRtcp()) { @@ -122,7 +122,7 @@ void RtpSlideShowHandler::write(Context *ctx, std::shared_ptr packet } } -bool RtpSlideShowHandler::isVP8Keyframe(std::shared_ptr packet) { +bool RtpSlideShowHandler::isVP8Keyframe(std::shared_ptr packet) { bool is_keyframe = false; RtpHeader *rtp_header = reinterpret_cast(packet->data); uint16_t seq_num = rtp_header->getSeqNumber(); @@ -143,7 +143,7 @@ bool RtpSlideShowHandler::isVP8Keyframe(std::shared_ptr packet) { return is_keyframe; } -bool RtpSlideShowHandler::isVP9Keyframe(std::shared_ptr packet) { +bool RtpSlideShowHandler::isVP9Keyframe(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); uint16_t seq_num = rtp_header->getSeqNumber(); uint32_t timestamp = rtp_header->getTimestamp(); @@ -152,7 +152,7 @@ bool RtpSlideShowHandler::isVP9Keyframe(std::shared_ptr packet) { if (RtpUtils::sequenceNumberLessThan(seq_num, first_keyframe_seq_num_)) { first_keyframe_seq_num_ = seq_num; for (uint16_t index = seq_num; index < first_keyframe_seq_num_; index++) { - keyframe_buffer_.push_back(std::shared_ptr{}); + keyframe_buffer_.push_back(std::shared_ptr{}); } } if (timestamp != current_keyframe_timestamp_) { @@ -166,7 +166,7 @@ bool RtpSlideShowHandler::isVP9Keyframe(std::shared_ptr packet) { return packet->is_keyframe; } -void RtpSlideShowHandler::storeKeyframePacket(std::shared_ptr packet) { +void RtpSlideShowHandler::storeKeyframePacket(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); uint16_t index = rtp_header->getSeqNumber() - first_keyframe_seq_num_; if (index < keyframe_buffer_.size()) { @@ -213,9 +213,9 @@ void RtpSlideShowHandler::consolidateKeyframe() { resetKeyframeBuilding(); return; } - std::shared_ptr packet; + std::shared_ptr packet; bool keyframe_complete = false; - std::vector> temp_keyframe; + std::vector> temp_keyframe; for (int seq_num = 0; seq_num < kMaxKeyframeSize; seq_num++) { packet = keyframe_buffer_[seq_num]; diff --git a/erizo/src/erizo/rtp/RtpSlideShowHandler.h b/erizo/src/erizo/rtp/RtpSlideShowHandler.h index 00c3d97f5e..e07b0d568b 100644 --- a/erizo/src/erizo/rtp/RtpSlideShowHandler.h +++ b/erizo/src/erizo/rtp/RtpSlideShowHandler.h @@ -29,20 +29,20 @@ class RtpSlideShowHandler : public Handler { return "slideshow"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; void setSlideShowMode(bool activated); private: - bool isVP8Keyframe(std::shared_ptr packet); - bool isVP9Keyframe(std::shared_ptr packet); + bool isVP8Keyframe(std::shared_ptr packet); + bool isVP9Keyframe(std::shared_ptr packet); void maybeUpdateHighestSeqNum(uint16_t seq_num); void resetKeyframeBuilding(); void consolidateKeyframe(); void maybeSendStoredKeyframe(); - void storeKeyframePacket(std::shared_ptr packet); + void storeKeyframePacket(std::shared_ptr packet); private: std::shared_ptr clock_; @@ -57,8 +57,8 @@ class RtpSlideShowHandler : public Handler { uint32_t current_keyframe_timestamp_; uint32_t last_timestamp_received_; - std::vector> keyframe_buffer_; - std::vector> stored_keyframe_; + std::vector> keyframe_buffer_; + std::vector> stored_keyframe_; time_point last_keyframe_sent_time_; }; } // namespace erizo diff --git a/erizo/src/erizo/rtp/RtpSource.cpp b/erizo/src/erizo/rtp/RtpSource.cpp index 0629f5d2b3..fbac7999d9 100644 --- a/erizo/src/erizo/rtp/RtpSource.cpp +++ b/erizo/src/erizo/rtp/RtpSource.cpp @@ -33,14 +33,14 @@ RtpSource::~RtpSource() { rtpSource_thread_.join(); } -int RtpSource::deliverFeedback_(std::shared_ptr fb_packet) { +int RtpSource::deliverFeedback_(std::shared_ptr fb_packet) { fbSocket_->send_to(boost::asio::buffer(fb_packet->data, fb_packet->length), *iterator_); return fb_packet->length; } void RtpSource::handleReceive(const::boost::system::error_code& error, size_t bytes_recvd) { // NOLINT if (bytes_recvd > 0 && this->video_sink_) { - this->video_sink_->deliverVideoData(std::make_shared(0, reinterpret_cast(buffer_), + this->video_sink_->deliverVideoData(std::make_shared(0, reinterpret_cast(buffer_), static_cast(bytes_recvd), OTHER_PACKET)); } } diff --git a/erizo/src/erizo/rtp/RtpSource.h b/erizo/src/erizo/rtp/RtpSource.h index a45112488e..3de2ab4310 100644 --- a/erizo/src/erizo/rtp/RtpSource.h +++ b/erizo/src/erizo/rtp/RtpSource.h @@ -37,7 +37,7 @@ class RtpSource: public MediaSource, public FeedbackSink { char* buffer_[LENGTH]; void handleReceive(const::boost::system::error_code& error, size_t bytes_recvd); // NOLINT void eventLoop(); - int deliverFeedback_(std::shared_ptr fb_packet) override; + int deliverFeedback_(std::shared_ptr fb_packet) override; }; diff --git a/erizo/src/erizo/rtp/RtpTrackMuteHandler.cpp b/erizo/src/erizo/rtp/RtpTrackMuteHandler.cpp index 969fd23ddc..92bd1d2d37 100644 --- a/erizo/src/erizo/rtp/RtpTrackMuteHandler.cpp +++ b/erizo/src/erizo/rtp/RtpTrackMuteHandler.cpp @@ -24,7 +24,7 @@ void RtpTrackMuteHandler::notifyUpdate() { muteTrack(&video_info_, connection_->isVideoMuted()); } -void RtpTrackMuteHandler::read(Context *ctx, std::shared_ptr packet) { +void RtpTrackMuteHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (connection_->getAudioSinkSSRC() == chead->getSourceSSRC()) { @@ -36,7 +36,7 @@ void RtpTrackMuteHandler::read(Context *ctx, std::shared_ptr packet) ctx->fireRead(std::move(packet)); } -void RtpTrackMuteHandler::handleFeedback(const TrackMuteInfo &info, const std::shared_ptr &packet) { +void RtpTrackMuteHandler::handleFeedback(const TrackMuteInfo &info, const std::shared_ptr &packet) { RtcpHeader *chead = reinterpret_cast(packet->data); uint16_t offset = info.seq_num_offset; if (offset > 0) { @@ -68,7 +68,7 @@ void RtpTrackMuteHandler::handleFeedback(const TrackMuteInfo &info, const std::s } } -void RtpTrackMuteHandler::write(Context *ctx, std::shared_ptr packet) { +void RtpTrackMuteHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader *rtcp_header = reinterpret_cast(packet->data); if (rtcp_header->isRtcp()) { ctx->fireWrite(std::move(packet)); @@ -81,7 +81,7 @@ void RtpTrackMuteHandler::write(Context *ctx, std::shared_ptr packet } } -void RtpTrackMuteHandler::handlePacket(Context *ctx, TrackMuteInfo *info, std::shared_ptr packet) { +void RtpTrackMuteHandler::handlePacket(Context *ctx, TrackMuteInfo *info, std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); uint16_t offset = info->seq_num_offset; info->last_original_seq_num = rtp_header->getSeqNumber(); @@ -119,7 +119,7 @@ void RtpTrackMuteHandler::muteTrack(TrackMuteInfo *info, bool active) { } } -inline void RtpTrackMuteHandler::setPacketSeqNumber(std::shared_ptr packet, uint16_t seq_number) { +inline void RtpTrackMuteHandler::setPacketSeqNumber(std::shared_ptr packet, uint16_t seq_number) { RtpHeader *head = reinterpret_cast (packet->data); RtcpHeader *chead = reinterpret_cast (packet->data); if (chead->isRtcp()) { diff --git a/erizo/src/erizo/rtp/RtpTrackMuteHandler.h b/erizo/src/erizo/rtp/RtpTrackMuteHandler.h index 7dbca943e7..b457bbf74c 100644 --- a/erizo/src/erizo/rtp/RtpTrackMuteHandler.h +++ b/erizo/src/erizo/rtp/RtpTrackMuteHandler.h @@ -37,15 +37,15 @@ class RtpTrackMuteHandler: public Handler { return "track-mute"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: void muteTrack(TrackMuteInfo *info, bool active); - void handleFeedback(const TrackMuteInfo &info, const std::shared_ptr &packet); - void handlePacket(Context *ctx, TrackMuteInfo *info, std::shared_ptr packet); - inline void setPacketSeqNumber(std::shared_ptr packet, uint16_t seq_number); + void handleFeedback(const TrackMuteInfo &info, const std::shared_ptr &packet); + void handlePacket(Context *ctx, TrackMuteInfo *info, std::shared_ptr packet); + inline void setPacketSeqNumber(std::shared_ptr packet, uint16_t seq_number); private: TrackMuteInfo audio_info_; diff --git a/erizo/src/erizo/rtp/RtpUtils.cpp b/erizo/src/erizo/rtp/RtpUtils.cpp index 445c2a3688..7472e6a732 100644 --- a/erizo/src/erizo/rtp/RtpUtils.cpp +++ b/erizo/src/erizo/rtp/RtpUtils.cpp @@ -38,7 +38,7 @@ void RtpUtils::forEachNack(RtcpHeader *chead, std::function packet) { +bool RtpUtils::isPLI(std::shared_ptr packet) { bool is_pli = false; forEachRRBlock(packet, [&is_pli] (RtcpHeader *header) { if (header->getPacketType() == RTCP_PS_Feedback_PT && @@ -49,7 +49,7 @@ bool RtpUtils::isPLI(std::shared_ptr packet) { return is_pli; } -bool RtpUtils::isFIR(std::shared_ptr packet) { +bool RtpUtils::isFIR(std::shared_ptr packet) { bool is_fir = false; forEachRRBlock(packet, [&is_fir] (RtcpHeader *header) { if (header->getPacketType() == RTCP_PS_Feedback_PT && @@ -60,7 +60,7 @@ bool RtpUtils::isFIR(std::shared_ptr packet) { return is_fir; } -std::shared_ptr RtpUtils::createPLI(uint32_t source_ssrc, uint32_t sink_ssrc) { +std::shared_ptr RtpUtils::createPLI(uint32_t source_ssrc, uint32_t sink_ssrc) { RtcpHeader pli; pli.setPacketType(RTCP_PS_Feedback_PT); pli.setBlockCount(RTCP_PLI_FMT); @@ -69,10 +69,10 @@ std::shared_ptr RtpUtils::createPLI(uint32_t source_ssrc, uint32_t s pli.setLength(2); char *buf = reinterpret_cast(&pli); int len = (pli.getLength() + 1) * 4; - return std::make_shared(0, buf, len, VIDEO_PACKET); + return std::make_shared(0, buf, len, VIDEO_PACKET); } -std::shared_ptr RtpUtils::createFIR(uint32_t source_ssrc, uint32_t sink_ssrc, uint8_t seq_number) { +std::shared_ptr RtpUtils::createFIR(uint32_t source_ssrc, uint32_t sink_ssrc, uint8_t seq_number) { RtcpHeader fir; fir.setPacketType(RTCP_PS_Feedback_PT); fir.setBlockCount(RTCP_FIR_FMT); @@ -83,11 +83,11 @@ std::shared_ptr RtpUtils::createFIR(uint32_t source_ssrc, uint32_t s fir.setFIRSequenceNumber(seq_number); char *buf = reinterpret_cast(&fir); int len = (fir.getLength() + 1) * 4; - return std::make_shared(0, buf, len, VIDEO_PACKET); + return std::make_shared(0, buf, len, VIDEO_PACKET); } -int RtpUtils::getPaddingLength(std::shared_ptr packet) { +int RtpUtils::getPaddingLength(std::shared_ptr packet) { RtpHeader *rtp_header = reinterpret_cast(packet->data); if (rtp_header->hasPadding()) { return packet->data[packet->length - 1] & 0xFF; @@ -95,7 +95,7 @@ int RtpUtils::getPaddingLength(std::shared_ptr packet) { return 0; } -void RtpUtils::forEachRRBlock(std::shared_ptr packet, std::function f) { +void RtpUtils::forEachRRBlock(std::shared_ptr packet, std::function f) { RtcpHeader *chead = reinterpret_cast(packet->data); int len = packet->length; if (chead->isFeedback()) { @@ -115,7 +115,7 @@ void RtpUtils::forEachRRBlock(std::shared_ptr packet, std::function< } } -std::shared_ptr RtpUtils::makePaddingPacket(std::shared_ptr packet, uint8_t padding_size) { +std::shared_ptr RtpUtils::makePaddingPacket(std::shared_ptr packet, uint8_t padding_size) { erizo::RtpHeader *header = reinterpret_cast(packet->data); uint16_t packet_length = header->getHeaderLength() + padding_size; @@ -129,7 +129,7 @@ std::shared_ptr RtpUtils::makePaddingPacket(std::shared_ptr(packet->comp, packet_buffer, packet_length, packet->type); + return std::make_shared(packet->comp, packet_buffer, packet_length, packet->type); } } // namespace erizo diff --git a/erizo/src/erizo/rtp/RtpUtils.h b/erizo/src/erizo/rtp/RtpUtils.h index 2ac647366b..77e997dc95 100644 --- a/erizo/src/erizo/rtp/RtpUtils.h +++ b/erizo/src/erizo/rtp/RtpUtils.h @@ -15,23 +15,23 @@ class RtpUtils { public: static bool sequenceNumberLessThan(uint16_t first, uint16_t second); - static void forEachRRBlock(std::shared_ptr packet, std::function f); + static void forEachRRBlock(std::shared_ptr packet, std::function f); static void updateREMB(RtcpHeader *chead, uint bitrate); - static bool isPLI(std::shared_ptr packet); + static bool isPLI(std::shared_ptr packet); - static bool isFIR(std::shared_ptr packet); + static bool isFIR(std::shared_ptr packet); static void forEachNack(RtcpHeader *chead, std::function f); - static std::shared_ptr createPLI(uint32_t source_ssrc, uint32_t sink_ssrc); + static std::shared_ptr createPLI(uint32_t source_ssrc, uint32_t sink_ssrc); - static std::shared_ptr createFIR(uint32_t source_ssrc, uint32_t sink_ssrc, uint8_t seq_number); + static std::shared_ptr createFIR(uint32_t source_ssrc, uint32_t sink_ssrc, uint8_t seq_number); - static int getPaddingLength(std::shared_ptr packet); + static int getPaddingLength(std::shared_ptr packet); - static std::shared_ptr makePaddingPacket(std::shared_ptr packet, uint8_t padding_size); + static std::shared_ptr makePaddingPacket(std::shared_ptr packet, uint8_t padding_size); }; } // namespace erizo diff --git a/erizo/src/erizo/rtp/SRPacketHandler.cpp b/erizo/src/erizo/rtp/SRPacketHandler.cpp index ff6de82a72..c2853222b8 100644 --- a/erizo/src/erizo/rtp/SRPacketHandler.cpp +++ b/erizo/src/erizo/rtp/SRPacketHandler.cpp @@ -19,7 +19,7 @@ void SRPacketHandler::disable() { } -void SRPacketHandler::handleRtpPacket(std::shared_ptr packet) { +void SRPacketHandler::handleRtpPacket(std::shared_ptr packet) { RtpHeader *head = reinterpret_cast(packet->data); uint32_t ssrc = head->getSSRC(); auto sr_selected_info_iter = sr_info_map_.find(ssrc); @@ -35,7 +35,7 @@ void SRPacketHandler::handleRtpPacket(std::shared_ptr packet) { -void SRPacketHandler::handleSR(std::shared_ptr packet) { +void SRPacketHandler::handleSR(std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); uint32_t ssrc = chead->getSSRC(); auto sr_selected_info_iter = sr_info_map_.find(ssrc); @@ -51,7 +51,7 @@ void SRPacketHandler::handleSR(std::shared_ptr packet) { chead->setPacketsSent(selected_info->sent_packets); } -void SRPacketHandler::write(Context *ctx, std::shared_ptr packet) { +void SRPacketHandler::write(Context *ctx, std::shared_ptr packet) { if (initialized_ && enabled_) { RtcpHeader *chead = reinterpret_cast(packet->data); if (!chead->isRtcp() && enabled_) { @@ -63,7 +63,7 @@ void SRPacketHandler::write(Context *ctx, std::shared_ptr packet) { ctx->fireWrite(std::move(packet)); } -void SRPacketHandler::read(Context *ctx, std::shared_ptr packet) { +void SRPacketHandler::read(Context *ctx, std::shared_ptr packet) { ctx->fireRead(std::move(packet)); } diff --git a/erizo/src/erizo/rtp/SRPacketHandler.h b/erizo/src/erizo/rtp/SRPacketHandler.h index bb7cf5fd4e..a94c1e77ff 100644 --- a/erizo/src/erizo/rtp/SRPacketHandler.h +++ b/erizo/src/erizo/rtp/SRPacketHandler.h @@ -27,8 +27,8 @@ class SRPacketHandler: public Handler { return "sr_handler"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: @@ -43,8 +43,8 @@ class SRPacketHandler: public Handler { WebRtcConnection* connection_; std::map> sr_info_map_; - void handleRtpPacket(std::shared_ptr packet); - void handleSR(std::shared_ptr packet); + void handleRtpPacket(std::shared_ptr packet); + void handleSR(std::shared_ptr packet); }; } // namespace erizo diff --git a/erizo/src/erizo/rtp/SenderBandwidthEstimantionHandler.cpp b/erizo/src/erizo/rtp/SenderBandwidthEstimantionHandler.cpp index 18fff642cf..fb457c2007 100644 --- a/erizo/src/erizo/rtp/SenderBandwidthEstimantionHandler.cpp +++ b/erizo/src/erizo/rtp/SenderBandwidthEstimantionHandler.cpp @@ -55,7 +55,7 @@ void SenderBandwidthEstimationHandler::notifyUpdate() { initialized_ = true; } -void SenderBandwidthEstimationHandler::read(Context *ctx, std::shared_ptr packet) { +void SenderBandwidthEstimationHandler::read(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (chead->isFeedback()) { char* packet_pointer = packet->data; @@ -136,7 +136,7 @@ void SenderBandwidthEstimationHandler::read(Context *ctx, std::shared_ptrfireRead(std::move(packet)); } -void SenderBandwidthEstimationHandler::write(Context *ctx, std::shared_ptr packet) { +void SenderBandwidthEstimationHandler::write(Context *ctx, std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast(packet->data); if (!chead->isRtcp() && packet->type == VIDEO_PACKET) { period_packets_sent_++; diff --git a/erizo/src/erizo/rtp/SenderBandwidthEstimationHandler.h b/erizo/src/erizo/rtp/SenderBandwidthEstimationHandler.h index 08675419b8..607b1d4dd4 100644 --- a/erizo/src/erizo/rtp/SenderBandwidthEstimationHandler.h +++ b/erizo/src/erizo/rtp/SenderBandwidthEstimationHandler.h @@ -40,8 +40,8 @@ class SenderBandwidthEstimationHandler : public Handler, return "sender_bwe"; } - void read(Context *ctx, std::shared_ptr packet) override; - void write(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; void analyzeSr(RtcpHeader *head); diff --git a/erizo/src/erizo/rtp/StatsHandler.cpp b/erizo/src/erizo/rtp/StatsHandler.cpp index 096041b8a5..e3284cd7fc 100644 --- a/erizo/src/erizo/rtp/StatsHandler.cpp +++ b/erizo/src/erizo/rtp/StatsHandler.cpp @@ -24,7 +24,7 @@ void StatsCalculator::update(WebRtcConnection *connection, std::shared_ptr packet) { +void StatsCalculator::processPacket(std::shared_ptr packet) { RtcpHeader *chead = reinterpret_cast (packet->data); if (chead->isRtcp()) { processRtcpPacket(packet); @@ -33,7 +33,7 @@ void StatsCalculator::processPacket(std::shared_ptr packet) { } } -void StatsCalculator::processRtpPacket(std::shared_ptr packet) { +void StatsCalculator::processRtpPacket(std::shared_ptr packet) { char* buf = packet->data; int len = packet->length; RtpHeader* head = reinterpret_cast(buf); @@ -66,7 +66,7 @@ void StatsCalculator::incrStat(uint32_t ssrc, std::string stat) { getStatsInfo()[ssrc][stat]++; } -void StatsCalculator::processRtcpPacket(std::shared_ptr packet) { +void StatsCalculator::processRtcpPacket(std::shared_ptr packet) { char* buf = packet->data; int len = packet->length; @@ -186,7 +186,7 @@ void IncomingStatsHandler::notifyUpdate() { pipeline->getService()); } -void IncomingStatsHandler::read(Context *ctx, std::shared_ptr packet) { +void IncomingStatsHandler::read(Context *ctx, std::shared_ptr packet) { processPacket(packet); ctx->fireRead(std::move(packet)); } @@ -206,7 +206,7 @@ void OutgoingStatsHandler::notifyUpdate() { pipeline->getService()); } -void OutgoingStatsHandler::write(Context *ctx, std::shared_ptr packet) { +void OutgoingStatsHandler::write(Context *ctx, std::shared_ptr packet) { processPacket(packet); ctx->fireWrite(std::move(packet)); } diff --git a/erizo/src/erizo/rtp/StatsHandler.h b/erizo/src/erizo/rtp/StatsHandler.h index 8127c3cc22..8013aef151 100644 --- a/erizo/src/erizo/rtp/StatsHandler.h +++ b/erizo/src/erizo/rtp/StatsHandler.h @@ -22,7 +22,7 @@ class StatsCalculator { virtual ~StatsCalculator() {} void update(WebRtcConnection *connection, std::shared_ptr stats); - void processPacket(std::shared_ptr packet); + void processPacket(std::shared_ptr packet); StatNode& getStatsInfo() { return stats_->getNode(); @@ -33,8 +33,8 @@ class StatsCalculator { } private: - void processRtpPacket(std::shared_ptr packet); - void processRtcpPacket(std::shared_ptr packet); + void processRtpPacket(std::shared_ptr packet); + void processRtcpPacket(std::shared_ptr packet); void incrStat(uint32_t ssrc, std::string stat); private: @@ -55,7 +55,7 @@ class IncomingStatsHandler: public InboundHandler, public StatsCalculator { return "incoming-stats"; } - void read(Context *ctx, std::shared_ptr packet) override; + void read(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: @@ -75,7 +75,7 @@ class OutgoingStatsHandler: public OutboundHandler, public StatsCalculator { return "outgoing-stats"; } - void write(Context *ctx, std::shared_ptr packet) override; + void write(Context *ctx, std::shared_ptr packet) override; void notifyUpdate() override; private: diff --git a/erizo/src/test/OneToManyProcessorTest.cpp b/erizo/src/test/OneToManyProcessorTest.cpp index 2bcaf9ec42..b74e8c3cd1 100644 --- a/erizo/src/test/OneToManyProcessorTest.cpp +++ b/erizo/src/test/OneToManyProcessorTest.cpp @@ -9,7 +9,7 @@ using testing::_; using testing::Return; using testing::Eq; -using erizo::dataPacket; +using erizo::DataPacket; static const char kArbitraryPeerId[] = "111"; @@ -23,11 +23,11 @@ class MockPublisher: public erizo::MediaSource, public erizo::FeedbackSink { ~MockPublisher() {} void close() override {} int sendPLI() override { return 0; } - int deliverFeedback_(std::shared_ptr packet) override { + int deliverFeedback_(std::shared_ptr packet) override { return internalDeliverFeedback_(packet); } - MOCK_METHOD1(internalDeliverFeedback_, int(std::shared_ptr)); + MOCK_METHOD1(internalDeliverFeedback_, int(std::shared_ptr)); }; class MockSubscriber: public erizo::MediaSink, public erizo::FeedbackSource { @@ -37,15 +37,15 @@ class MockSubscriber: public erizo::MediaSink, public erizo::FeedbackSource { } ~MockSubscriber() {} void close() override {} - int deliverAudioData_(std::shared_ptr packet) override { + int deliverAudioData_(std::shared_ptr packet) override { return internalDeliverAudioData_(packet); } - int deliverVideoData_(std::shared_ptr packet) override { + int deliverVideoData_(std::shared_ptr packet) override { return internalDeliverVideoData_(packet); } - MOCK_METHOD1(internalDeliverAudioData_, int(std::shared_ptr)); - MOCK_METHOD1(internalDeliverVideoData_, int(std::shared_ptr)); + MOCK_METHOD1(internalDeliverAudioData_, int(std::shared_ptr)); + MOCK_METHOD1(internalDeliverVideoData_, int(std::shared_ptr)); }; class OneToManyProcessorTest : public ::testing::Test { @@ -97,7 +97,7 @@ TEST_F(OneToManyProcessorTest, deliverFeedback_CallsPublisher_WhenCalled) { header.setSeqNumber(12); EXPECT_CALL(*publisher.get(), internalDeliverFeedback_(_)).Times(1).WillOnce(Return(0)); - otm.deliverFeedback(std::make_shared(0, reinterpret_cast(&header), + otm.deliverFeedback(std::make_shared(0, reinterpret_cast(&header), sizeof(erizo::RtpHeader), erizo::VIDEO_PACKET)); } @@ -106,7 +106,7 @@ TEST_F(OneToManyProcessorTest, deliverVideoData_CallsSubscriber_whenCalled) { header.setSeqNumber(12); EXPECT_CALL(*subscriber, internalDeliverVideoData_(_)).Times(1).WillOnce(Return(0)); - otm.deliverVideoData(std::make_shared(0, reinterpret_cast(&header), + otm.deliverVideoData(std::make_shared(0, reinterpret_cast(&header), sizeof(erizo::RtpHeader), erizo::VIDEO_PACKET)); } @@ -115,6 +115,6 @@ TEST_F(OneToManyProcessorTest, deliverAudioData_CallsSubscriber_whenCalled) { header.setSeqNumber(12); EXPECT_CALL(*subscriber, internalDeliverAudioData_(_)).Times(1).WillOnce(Return(0)); - otm.deliverAudioData(std::make_shared(0, reinterpret_cast(&header), + otm.deliverAudioData(std::make_shared(0, reinterpret_cast(&header), sizeof(erizo::RtpHeader), erizo::AUDIO_PACKET)); } diff --git a/erizo/src/test/PacketTest.cpp b/erizo/src/test/PacketTest.cpp index 7eda9add69..082548aefb 100644 --- a/erizo/src/test/PacketTest.cpp +++ b/erizo/src/test/PacketTest.cpp @@ -27,7 +27,7 @@ TEST(erizoPacket, rtpPacketQueueBasicBehavior) { ASSERT_EQ(queue.hasData(), false); // If we try to pop this packet, we should get back a null shared_ptr object. - boost::shared_ptr packet = queue.popPacket(); + boost::shared_ptr packet = queue.popPacket(); ASSERT_THAT(packet.get(), IsNull()); ASSERT_EQ(queue.getSize(), 1); ASSERT_EQ(queue.hasData(), false); @@ -53,7 +53,7 @@ TEST(erizoPacket, rtpPacketQueueCorrectlyReordersSamples) { for (int x = 1; x <=10; x++) { // override our default pop behavior so we can validate these are ordered - boost::shared_ptr packet = queue.popPacket(true); + boost::shared_ptr packet = queue.popPacket(true); const erizo::RtpHeader *poppedHeader = reinterpret_cast(packet->data); ASSERT_EQ(poppedHeader->getSeqNumber(), x); } @@ -74,7 +74,7 @@ TEST(erizoPacket, rtpPacketQueueCorrectlyHandlesSequenceNumberRollover) { x = 65530; while (x != 5) { // override our default pop behavior so we can validate these are ordered - boost::shared_ptr packet = queue.popPacket(true); + boost::shared_ptr packet = queue.popPacket(true); const erizo::RtpHeader *poppedHeader = reinterpret_cast(packet->data); ASSERT_EQ(poppedHeader->getSeqNumber(), x); x += 1; @@ -97,7 +97,7 @@ TEST(erizoPacket, rtpPacketQueueCorrectlyHandlesSequenceNumberRolloverBackwards) x = 65530; while (x != 5) { // override our default pop behavior so we can validate these are ordered - boost::shared_ptr packet = queue.popPacket(true); + boost::shared_ptr packet = queue.popPacket(true); const erizo::RtpHeader *poppedHeader = reinterpret_cast(packet->data); ASSERT_EQ(poppedHeader->getSeqNumber(), x); x += 1; diff --git a/erizo/src/test/rtp/BandwidthEstimationHandlerTest.cpp b/erizo/src/test/rtp/BandwidthEstimationHandlerTest.cpp index 26f4a086cb..1748316cb0 100644 --- a/erizo/src/test/rtp/BandwidthEstimationHandlerTest.cpp +++ b/erizo/src/test/rtp/BandwidthEstimationHandlerTest.cpp @@ -20,7 +20,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/FecReceiverHandlerTest.cpp b/erizo/src/test/rtp/FecReceiverHandlerTest.cpp index f1ca5ac038..f67dde8d2d 100644 --- a/erizo/src/test/rtp/FecReceiverHandlerTest.cpp +++ b/erizo/src/test/rtp/FecReceiverHandlerTest.cpp @@ -19,7 +19,7 @@ using ::testing::IsNull; using ::testing::Eq; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/LayerDetectorHandlerTest.cpp b/erizo/src/test/rtp/LayerDetectorHandlerTest.cpp index 276528792f..d8bd38f49e 100644 --- a/erizo/src/test/rtp/LayerDetectorHandlerTest.cpp +++ b/erizo/src/test/rtp/LayerDetectorHandlerTest.cpp @@ -21,7 +21,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AllOf; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; @@ -88,7 +88,7 @@ class LayerDetectorHandlerVp8Test : public erizo::BaseHandlerTest, } std::shared_ptr layer_detector_handler; - std::shared_ptr packet; + std::shared_ptr packet; int ssrc; int tid; int spatial_layer_id; diff --git a/erizo/src/test/rtp/PliPacerHandlerTest.cpp b/erizo/src/test/rtp/PliPacerHandlerTest.cpp index f66a2b2009..e3581fc84a 100644 --- a/erizo/src/test/rtp/PliPacerHandlerTest.cpp +++ b/erizo/src/test/rtp/PliPacerHandlerTest.cpp @@ -17,7 +17,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtcpFeedbackGenerationHandlerTest.cpp b/erizo/src/test/rtp/RtcpFeedbackGenerationHandlerTest.cpp index 47498c1804..651e40913a 100644 --- a/erizo/src/test/rtp/RtcpFeedbackGenerationHandlerTest.cpp +++ b/erizo/src/test/rtp/RtcpFeedbackGenerationHandlerTest.cpp @@ -20,7 +20,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AllOf; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtcpNackGeneratorTest.cpp b/erizo/src/test/rtp/RtcpNackGeneratorTest.cpp index 5474b8a201..c6cfac3198 100644 --- a/erizo/src/test/rtp/RtcpNackGeneratorTest.cpp +++ b/erizo/src/test/rtp/RtcpNackGeneratorTest.cpp @@ -20,7 +20,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AllOf; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; @@ -39,14 +39,14 @@ class RtcpNackGeneratorTest :public ::testing::Test { clock->advanceTime(std::chrono::milliseconds(time_ms)); } - std::shared_ptr generateRrWithNack() { - std::shared_ptr new_receiver_report = erizo::PacketTools::createReceiverReport(erizo::kVideoSsrc, + std::shared_ptr generateRrWithNack() { + std::shared_ptr new_receiver_report = erizo::PacketTools::createReceiverReport(erizo::kVideoSsrc, erizo::kVideoSsrc, 0, VIDEO_PACKET); nack_generator.addNackPacketToRr(new_receiver_report); return new_receiver_report; } - bool RtcpPacketContainsNackSeqNum(std::shared_ptr rtcp_packet, uint16_t lost_seq_num) { + bool RtcpPacketContainsNackSeqNum(std::shared_ptr rtcp_packet, uint16_t lost_seq_num) { char* moving_buf = rtcp_packet->data; int rtcp_length = 0; int total_length = 0; @@ -82,7 +82,7 @@ class RtcpNackGeneratorTest :public ::testing::Test { } std::shared_ptr clock; - std::shared_ptr receiver_report; + std::shared_ptr receiver_report; RtcpNackGenerator nack_generator; const uint16_t kMaxSeqnum = 65534; }; diff --git a/erizo/src/test/rtp/RtcpProcessorHandlerTest.cpp b/erizo/src/test/rtp/RtcpProcessorHandlerTest.cpp index 703bd7dcf7..87c27a2b23 100644 --- a/erizo/src/test/rtp/RtcpProcessorHandlerTest.cpp +++ b/erizo/src/test/rtp/RtcpProcessorHandlerTest.cpp @@ -21,7 +21,7 @@ using ::testing::IsNull; using ::testing::Eq; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtcpRrGeneratorTest.cpp b/erizo/src/test/rtp/RtcpRrGeneratorTest.cpp index 562993da22..44d8264197 100644 --- a/erizo/src/test/rtp/RtcpRrGeneratorTest.cpp +++ b/erizo/src/test/rtp/RtcpRrGeneratorTest.cpp @@ -21,7 +21,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AllOf; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; @@ -51,7 +51,7 @@ TEST_F(RtcpRrGeneratorTest, shouldReportPacketLoss) { VIDEO_PACKET); rr_generator.handleRtpPacket(first_packet); rr_generator.handleRtpPacket(second_packet); - std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); + std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); RtcpHeader* rtcp_header = reinterpret_cast(rr_packet->data); EXPECT_EQ(rtcp_header->getLostPackets(), kArbitraryPacketsLost); } @@ -66,7 +66,7 @@ TEST_F(RtcpRrGeneratorTest, shouldReportFractionLost) { rr_generator.handleRtpPacket(first_packet); rr_generator.handleRtpPacket(second_packet); - std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); + std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); RtcpHeader* rtcp_header = reinterpret_cast(rr_packet->data); EXPECT_EQ(rtcp_header->getFractionLost(), kFractionLost); } @@ -80,7 +80,7 @@ TEST_F(RtcpRrGeneratorTest, shouldReportHighestSeqnum) { rr_generator.handleRtpPacket(first_packet); rr_generator.handleRtpPacket(second_packet); - std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); + std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); RtcpHeader* rtcp_header = reinterpret_cast(rr_packet->data); EXPECT_EQ(rtcp_header->getHighestSeqnum(), erizo::kArbitrarySeqNumber + kArbitraryNumberOfPackets); } @@ -97,7 +97,7 @@ TEST_F(RtcpRrGeneratorTest, shouldReportHighestSeqnumWithRollover) { rr_generator.handleRtpPacket(first_packet); rr_generator.handleRtpPacket(second_packet); - std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); + std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); RtcpHeader* rtcp_header = reinterpret_cast(rr_packet->data); EXPECT_EQ(rtcp_header->getSeqnumCycles(), kSeqnumCyclesExpected); EXPECT_EQ(rtcp_header->getHighestSeqnum(), kNewSeqNum); @@ -114,7 +114,7 @@ TEST_F(RtcpRrGeneratorTest, shouldReportDelaySinceLastSr) { rr_generator.handleSr(sender_report); advanceClockMs(kArbitraryTimePassedInMs); - std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); + std::shared_ptr rr_packet = rr_generator.generateReceiverReport(); RtcpHeader* rtcp_header = reinterpret_cast(rr_packet->data); EXPECT_EQ(rtcp_header->getDelaySinceLastSr(), kArbitratyTimePassed); } diff --git a/erizo/src/test/rtp/RtpPaddingGeneratorHandlerTest.cpp b/erizo/src/test/rtp/RtpPaddingGeneratorHandlerTest.cpp index da0561387f..029e225e1c 100644 --- a/erizo/src/test/rtp/RtpPaddingGeneratorHandlerTest.cpp +++ b/erizo/src/test/rtp/RtpPaddingGeneratorHandlerTest.cpp @@ -20,7 +20,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AtLeast; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtpRetransmissionHandlerTest.cpp b/erizo/src/test/rtp/RtpRetransmissionHandlerTest.cpp index a3372e710b..f78b1328e2 100644 --- a/erizo/src/test/rtp/RtpRetransmissionHandlerTest.cpp +++ b/erizo/src/test/rtp/RtpRetransmissionHandlerTest.cpp @@ -19,7 +19,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtpSlideShowHandlerTest.cpp b/erizo/src/test/rtp/RtpSlideShowHandlerTest.cpp index 82a9fdc458..969ca7765b 100644 --- a/erizo/src/test/rtp/RtpSlideShowHandlerTest.cpp +++ b/erizo/src/test/rtp/RtpSlideShowHandlerTest.cpp @@ -19,7 +19,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/RtpTrackMuteHandlerTest.cpp b/erizo/src/test/rtp/RtpTrackMuteHandlerTest.cpp index 5cd3066a85..ef6551b75f 100644 --- a/erizo/src/test/rtp/RtpTrackMuteHandlerTest.cpp +++ b/erizo/src/test/rtp/RtpTrackMuteHandlerTest.cpp @@ -18,7 +18,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/SRPacketHandlerTest.cpp b/erizo/src/test/rtp/SRPacketHandlerTest.cpp index 4622078fb5..0d2162daab 100644 --- a/erizo/src/test/rtp/SRPacketHandlerTest.cpp +++ b/erizo/src/test/rtp/SRPacketHandlerTest.cpp @@ -19,7 +19,7 @@ using ::testing::IsNull; using ::testing::Args; using ::testing::Return; using ::testing::AllOf; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/SenderBandwidthEstimationTest.cpp b/erizo/src/test/rtp/SenderBandwidthEstimationTest.cpp index 6f97459f9c..71d9a7c50e 100644 --- a/erizo/src/test/rtp/SenderBandwidthEstimationTest.cpp +++ b/erizo/src/test/rtp/SenderBandwidthEstimationTest.cpp @@ -19,7 +19,7 @@ using ::testing::IsNull; using ::testing::Eq; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/rtp/StatsHandlerTest.cpp b/erizo/src/test/rtp/StatsHandlerTest.cpp index 57fa3b1b92..e237e94924 100644 --- a/erizo/src/test/rtp/StatsHandlerTest.cpp +++ b/erizo/src/test/rtp/StatsHandlerTest.cpp @@ -18,7 +18,7 @@ using ::testing::_; using ::testing::IsNull; using ::testing::Args; using ::testing::Return; -using erizo::dataPacket; +using erizo::DataPacket; using erizo::packetType; using erizo::AUDIO_PACKET; using erizo::VIDEO_PACKET; diff --git a/erizo/src/test/utils/Mocks.h b/erizo/src/test/utils/Mocks.h index 1d76a001cd..cda3503bd2 100644 --- a/erizo/src/test/utils/Mocks.h +++ b/erizo/src/test/utils/Mocks.h @@ -45,11 +45,11 @@ class MockMediaSink : public MediaSink { MOCK_METHOD2(deliverVideoDataInternal, void(char*, int)); private: - int deliverAudioData_(std::shared_ptr audio_packet) override { + int deliverAudioData_(std::shared_ptr audio_packet) override { deliverAudioDataInternal(audio_packet->data, audio_packet->length); return 0; } - int deliverVideoData_(std::shared_ptr video_packet) override { + int deliverVideoData_(std::shared_ptr video_packet) override { deliverVideoDataInternal(video_packet->data, video_packet->length); return 0; } @@ -71,7 +71,7 @@ class Reader : public InboundHandler { MOCK_METHOD0(disable, void()); MOCK_METHOD0(notifyUpdate, void()); MOCK_METHOD0(getName, std::string()); - MOCK_METHOD2(read, void(Context*, std::shared_ptr)); + MOCK_METHOD2(read, void(Context*, std::shared_ptr)); }; class Writer : public OutboundHandler { @@ -80,7 +80,7 @@ class Writer : public OutboundHandler { MOCK_METHOD0(disable, void()); MOCK_METHOD0(notifyUpdate, void()); MOCK_METHOD0(getName, std::string()); - MOCK_METHOD2(write, void(Context*, std::shared_ptr)); + MOCK_METHOD2(write, void(Context*, std::shared_ptr)); }; class MockRemoteBitrateEstimatorPicker : public RemoteBitrateEstimatorPicker { diff --git a/erizo/src/test/utils/Tools.h b/erizo/src/test/utils/Tools.h index ff5dafa9f5..c8380d2c3c 100644 --- a/erizo/src/test/utils/Tools.h +++ b/erizo/src/test/utils/Tools.h @@ -19,7 +19,7 @@ static constexpr uint16_t kLastSequenceNumber = 65535; class PacketTools { public: - static std::shared_ptr createDataPacket(uint16_t seq_number, packetType type) { + static std::shared_ptr createDataPacket(uint16_t seq_number, packetType type) { erizo::RtpHeader *header = new erizo::RtpHeader(); header->setSeqNumber(seq_number); @@ -29,10 +29,10 @@ class PacketTools { header->setSSRC(kVideoSsrc); } - return std::make_shared(0, reinterpret_cast(header), sizeof(erizo::RtpHeader), type); + return std::make_shared(0, reinterpret_cast(header), sizeof(erizo::RtpHeader), type); } - static std::shared_ptr createNack(uint ssrc, uint source_ssrc, uint16_t seq_number, + static std::shared_ptr createNack(uint ssrc, uint source_ssrc, uint16_t seq_number, packetType type, int additional_packets = 0) { erizo::RtcpHeader *nack = new erizo::RtcpHeader(); nack->setPacketType(RTCP_RTP_Feedback_PT); @@ -44,10 +44,10 @@ class PacketTools { nack->setLength(3); char *buf = reinterpret_cast(nack); int len = (nack->getLength() + 1) * 4; - return std::make_shared(0, buf, len, type); + return std::make_shared(0, buf, len, type); } - static std::shared_ptr createReceiverReport(uint ssrc, uint source_ssrc, + static std::shared_ptr createReceiverReport(uint ssrc, uint source_ssrc, uint16_t highest_seq_num, packetType type, uint32_t last_sender_report = 0, uint32_t fraction_lost = 0) { erizo::RtcpHeader *receiver_report = new erizo::RtcpHeader(); @@ -61,10 +61,10 @@ class PacketTools { receiver_report->setLength(7); char *buf = reinterpret_cast(receiver_report); int len = (receiver_report->getLength() + 1) * 4; - return std::make_shared(0, buf, len, type); + return std::make_shared(0, buf, len, type); } - static std::shared_ptr createSenderReport(uint ssrc, packetType type, + static std::shared_ptr createSenderReport(uint ssrc, packetType type, uint32_t packets_sent = 0, uint32_t octets_sent = 0, uint64_t ntp_timestamp = 0) { erizo::RtcpHeader *sender_report = new erizo::RtcpHeader(); sender_report->setPacketType(RTCP_Sender_PT); @@ -76,10 +76,10 @@ class PacketTools { sender_report->setOctetsSent(octets_sent); char *buf = reinterpret_cast(sender_report); int len = (sender_report->getLength() + 1) * 4; - return std::make_shared(0, buf, len, type); + return std::make_shared(0, buf, len, type); } - static std::shared_ptr createVP8Packet(uint16_t seq_number, bool is_keyframe, bool is_marker) { + static std::shared_ptr createVP8Packet(uint16_t seq_number, bool is_keyframe, bool is_marker) { erizo::RtpHeader *header = new erizo::RtpHeader(); header->setPayloadType(96); header->setSeqNumber(seq_number); @@ -97,12 +97,12 @@ class PacketTools { parsing_pointer++; *parsing_pointer = is_keyframe? 0x00: 0x01; - auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); + auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); packet->is_keyframe = is_keyframe; return packet; } - static std::shared_ptr createVP8Packet(uint16_t seq_number, uint32_t timestamp, + static std::shared_ptr createVP8Packet(uint16_t seq_number, uint32_t timestamp, bool is_keyframe, bool is_marker) { erizo::RtpHeader *header = new erizo::RtpHeader(); header->setPayloadType(96); @@ -122,12 +122,12 @@ class PacketTools { parsing_pointer++; *parsing_pointer = is_keyframe? 0x00: 0x01; - auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); + auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); packet->is_keyframe = is_keyframe; return packet; } - static std::shared_ptr createVP9Packet(uint16_t seq_number, bool is_keyframe, bool is_marker) { + static std::shared_ptr createVP9Packet(uint16_t seq_number, bool is_keyframe, bool is_marker) { erizo::RtpHeader *header = new erizo::RtpHeader(); header->setPayloadType(98); header->setSeqNumber(seq_number); @@ -143,12 +143,12 @@ class PacketTools { *parsing_pointer = is_keyframe? 0x00: 0x40; - auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); + auto packet = std::make_shared(0, packet_buffer, 200, VIDEO_PACKET); packet->is_keyframe = is_keyframe; return packet; } - static std::shared_ptr createRembPacket(uint32_t bitrate) { + static std::shared_ptr createRembPacket(uint32_t bitrate) { erizo::RtcpHeader *remb_packet = new erizo::RtcpHeader(); remb_packet->setPacketType(RTCP_PS_Feedback_PT); remb_packet->setBlockCount(RTCP_AFB); @@ -162,12 +162,12 @@ class PacketTools { remb_packet->setREMBFeedSSRC(55554); int remb_length = (remb_packet->getLength() + 1) * 4; char *buf = reinterpret_cast(remb_packet); - auto packet = std::make_shared(0, buf, remb_length, erizo::OTHER_PACKET); + auto packet = std::make_shared(0, buf, remb_length, erizo::OTHER_PACKET); delete remb_packet; return packet; } - static std::shared_ptr createPLI() { + static std::shared_ptr createPLI() { erizo::RtcpHeader *pli = new erizo::RtcpHeader(); pli->setPacketType(RTCP_PS_Feedback_PT); pli->setBlockCount(1); @@ -176,7 +176,7 @@ class PacketTools { pli->setLength(2); char *buf = reinterpret_cast(pli); int len = (pli->getLength() + 1) * 4; - auto packet = std::make_shared(0, buf, len, erizo::OTHER_PACKET); + auto packet = std::make_shared(0, buf, len, erizo::OTHER_PACKET); delete pli; return packet; } @@ -254,7 +254,7 @@ class BaseHandlerTest { std::shared_ptr simulated_worker; std::shared_ptr io_worker; std::shared_ptr packet_buffer_service; - std::queue> packet_queue; + std::queue> packet_queue; }; class HandlerTest : public ::testing::Test, public BaseHandlerTest {