diff --git a/talk/media/webrtc/fakewebrtcvoiceengine.h b/talk/media/webrtc/fakewebrtcvoiceengine.h index c6d39bbb22..910889f4b9 100644 --- a/talk/media/webrtc/fakewebrtcvoiceengine.h +++ b/talk/media/webrtc/fakewebrtcvoiceengine.h @@ -1035,10 +1035,6 @@ class FakeWebRtcVoiceEngine channels_[channel]->nack_max_packets = maxNoPackets; return 0; } - WEBRTC_STUB(StartRTPDump, (int channel, const char* fileNameUTF8, - webrtc::RTPDirections direction)); - WEBRTC_STUB(StopRTPDump, (int channel, webrtc::RTPDirections direction)); - WEBRTC_STUB(RTPDumpIsActive, (int channel, webrtc::RTPDirections direction)); WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType, bool markerBit, const char* payloadData, unsigned short payloadSize)); diff --git a/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc b/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc index 8159245a74..bb5eeedc87 100644 --- a/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc +++ b/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc @@ -400,22 +400,6 @@ JOWW(jint, VoiceEngine_stopDebugRecording)(JNIEnv* jni, jobject j_voe) { return voe_data->apm->StopDebugRecording(); } -JOWW(jint, VoiceEngine_startRtpDump)(JNIEnv* jni, jobject j_voe, jint channel, - jstring j_filename, jint direction) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - std::string filename = JavaToStdString(jni, j_filename); - return voe_data->rtp->StartRTPDump( - channel, filename.c_str(), - static_cast(direction)); -} - -JOWW(jint, VoiceEngine_stopRtpDump)(JNIEnv* jni, jobject j_voe, jint channel, - jint direction) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->rtp->StopRTPDump( - channel, static_cast(direction)); -} - JOWW(void, CodecInst_dispose)(JNIEnv* jni, jobject j_codec) { delete GetCodecInst(jni, j_codec); } diff --git a/webrtc/modules/utility/BUILD.gn b/webrtc/modules/utility/BUILD.gn index 3deed6f5e7..163515c466 100644 --- a/webrtc/modules/utility/BUILD.gn +++ b/webrtc/modules/utility/BUILD.gn @@ -16,7 +16,6 @@ source_set("utility") { "interface/helpers_android.h", "interface/jvm_android.h", "interface/process_thread.h", - "interface/rtp_dump.h", "source/audio_frame_operations.cc", "source/coder.cc", "source/coder.h", @@ -28,8 +27,6 @@ source_set("utility") { "source/jvm_android.cc", "source/process_thread_impl.cc", "source/process_thread_impl.h", - "source/rtp_dump_impl.cc", - "source/rtp_dump_impl.h", ] configs += [ "../..:common_config" ] diff --git a/webrtc/modules/utility/interface/rtp_dump.h b/webrtc/modules/utility/interface/rtp_dump.h deleted file mode 100644 index df45ae209d..0000000000 --- a/webrtc/modules/utility/interface/rtp_dump.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file implements a class that writes a stream of RTP and RTCP packets -// to a file according to the format specified by rtpplay. See -// http://www.cs.columbia.edu/irt/software/rtptools/. -// Notes: supported platforms are Windows, Linux and Mac OSX - -#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_ -#define WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_ - -#include "webrtc/system_wrappers/interface/file_wrapper.h" -#include "webrtc/typedefs.h" - -namespace webrtc { -class RtpDump -{ -public: - // Factory method. - static RtpDump* CreateRtpDump(); - - // Delete function. Destructor disabled. - static void DestroyRtpDump(RtpDump* object); - - // Open the file fileNameUTF8 for writing RTP/RTCP packets. - // Note: this API also adds the rtpplay header. - virtual int32_t Start(const char* fileNameUTF8) = 0; - - // Close the existing file. No more packets will be recorded. - virtual int32_t Stop() = 0; - - // Return true if a file is open for recording RTP/RTCP packets. - virtual bool IsActive() const = 0; - - // Writes the RTP/RTCP packet in packet with length packetLength in bytes. - // Note: packet should contain the RTP/RTCP part of the packet. I.e. the - // first bytes of packet should be the RTP/RTCP header. - virtual int32_t DumpPacket(const uint8_t* packet, - size_t packetLength) = 0; - -protected: - virtual ~RtpDump(); -}; -} // namespace webrtc -#endif // WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_ diff --git a/webrtc/modules/utility/source/rtp_dump_impl.cc b/webrtc/modules/utility/source/rtp_dump_impl.cc deleted file mode 100644 index 495a1e4060..0000000000 --- a/webrtc/modules/utility/source/rtp_dump_impl.cc +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/utility/source/rtp_dump_impl.h" - -#include -#include -#include - -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/logging.h" - -#if defined(_WIN32) -#include -#include -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) -#include -#include -#include -#endif - -#if (defined(_DEBUG) && defined(_WIN32)) -#define DEBUG_PRINT(expr) OutputDebugString(##expr) -#define DEBUG_PRINTP(expr, p) \ -{ \ - char msg[128]; \ - sprintf(msg, ##expr, p); \ - OutputDebugString(msg); \ -} -#else -#define DEBUG_PRINT(expr) ((void)0) -#define DEBUG_PRINTP(expr,p) ((void)0) -#endif // defined(_DEBUG) && defined(_WIN32) - -namespace webrtc { -const char RTPFILE_VERSION[] = "1.0"; -const uint32_t MAX_UWORD32 = 0xffffffff; - -// This stucture is specified in the rtpdump documentation. -// This struct corresponds to RD_packet_t in -// http://www.cs.columbia.edu/irt/software/rtptools/ -typedef struct -{ - // Length of packet, including this header (may be smaller than plen if not - // whole packet recorded). - uint16_t length; - // Actual header+payload length for RTP, 0 for RTCP. - uint16_t plen; - // Milliseconds since the start of recording. - uint32_t offset; -} RtpDumpPacketHeader; - -RtpDump* RtpDump::CreateRtpDump() -{ - return new RtpDumpImpl(); -} - -void RtpDump::DestroyRtpDump(RtpDump* object) -{ - delete object; -} - -RtpDumpImpl::RtpDumpImpl() - : _critSect(CriticalSectionWrapper::CreateCriticalSection()), - _file(*FileWrapper::Create()), - _startTime(0) -{ -} - -RtpDump::~RtpDump() -{ -} - -RtpDumpImpl::~RtpDumpImpl() -{ - _file.Flush(); - _file.CloseFile(); - delete &_file; - delete _critSect; -} - -int32_t RtpDumpImpl::Start(const char* fileNameUTF8) -{ - - if (fileNameUTF8 == NULL) - { - return -1; - } - - CriticalSectionScoped lock(_critSect); - _file.Flush(); - _file.CloseFile(); - if (_file.OpenFile(fileNameUTF8, false, false, false) == -1) - { - LOG(LS_ERROR) << "Failed to open file."; - return -1; - } - - // Store start of RTP dump (to be used for offset calculation later). - _startTime = GetTimeInMS(); - - // All rtp dump files start with #!rtpplay. - char magic[16]; - sprintf(magic, "#!rtpplay%s \n", RTPFILE_VERSION); - if (_file.WriteText(magic) == -1) - { - LOG(LS_ERROR) << "Error writing to file."; - return -1; - } - - // The header according to the rtpdump documentation is sizeof(RD_hdr_t) - // which is 8 + 4 + 2 = 14 bytes for 32-bit architecture (and 22 bytes on - // 64-bit architecture). However, Wireshark use 16 bytes for the header - // regardless of if the binary is 32-bit or 64-bit. Go by the same approach - // as Wireshark since it makes more sense. - // http://wiki.wireshark.org/rtpdump explains that an additional 2 bytes - // of padding should be added to the header. - char dummyHdr[16]; - memset(dummyHdr, 0, 16); - if (!_file.Write(dummyHdr, sizeof(dummyHdr))) - { - LOG(LS_ERROR) << "Error writing to file."; - return -1; - } - return 0; -} - -int32_t RtpDumpImpl::Stop() -{ - CriticalSectionScoped lock(_critSect); - _file.Flush(); - _file.CloseFile(); - return 0; -} - -bool RtpDumpImpl::IsActive() const -{ - CriticalSectionScoped lock(_critSect); - return _file.Open(); -} - -int32_t RtpDumpImpl::DumpPacket(const uint8_t* packet, size_t packetLength) -{ - CriticalSectionScoped lock(_critSect); - if (!IsActive()) - { - return 0; - } - - if (packet == NULL) - { - return -1; - } - - RtpDumpPacketHeader hdr; - size_t total_size = packetLength + sizeof hdr; - if (packetLength < 1 || total_size > std::numeric_limits::max()) - { - return -1; - } - - // If the packet doesn't contain a valid RTCP header the packet will be - // considered RTP (without further verification). - bool isRTCP = RTCP(packet); - - // Offset is relative to when recording was started. - uint32_t offset = GetTimeInMS(); - if (offset < _startTime) - { - // Compensate for wraparound. - offset += MAX_UWORD32 - _startTime + 1; - } else { - offset -= _startTime; - } - hdr.offset = RtpDumpHtonl(offset); - - hdr.length = RtpDumpHtons((uint16_t)(total_size)); - if (isRTCP) - { - hdr.plen = 0; - } - else - { - hdr.plen = RtpDumpHtons((uint16_t)packetLength); - } - - if (!_file.Write(&hdr, sizeof(hdr))) - { - LOG(LS_ERROR) << "Error writing to file."; - return -1; - } - if (!_file.Write(packet, packetLength)) - { - LOG(LS_ERROR) << "Error writing to file."; - return -1; - } - - return 0; -} - -bool RtpDumpImpl::RTCP(const uint8_t* packet) const -{ - return packet[1] == 192 || packet[1] == 200 || packet[1] == 201 || - packet[1] == 202 || packet[1] == 203 || packet[1] == 204 || - packet[1] == 205 || packet[1] == 206 || packet[1] == 207; -} - -// TODO (hellner): why is TickUtil not used here? -inline uint32_t RtpDumpImpl::GetTimeInMS() const -{ -#if defined(_WIN32) - return timeGetTime(); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) - struct timeval tv; - struct timezone tz; - unsigned long val; - - gettimeofday(&tv, &tz); - val = tv.tv_sec * 1000 + tv.tv_usec / 1000; - return val; -#endif -} - -inline uint32_t RtpDumpImpl::RtpDumpHtonl(uint32_t x) const -{ -#if defined(WEBRTC_ARCH_BIG_ENDIAN) - return x; -#elif defined(WEBRTC_ARCH_LITTLE_ENDIAN) - return (x >> 24) + ((((x >> 16) & 0xFF) << 8) + ((((x >> 8) & 0xFF) << 16) + - ((x & 0xFF) << 24))); -#endif -} - -inline uint16_t RtpDumpImpl::RtpDumpHtons(uint16_t x) const -{ -#if defined(WEBRTC_ARCH_BIG_ENDIAN) - return x; -#elif defined(WEBRTC_ARCH_LITTLE_ENDIAN) - return (x >> 8) + ((x & 0xFF) << 8); -#endif -} -} // namespace webrtc diff --git a/webrtc/modules/utility/source/rtp_dump_impl.h b/webrtc/modules/utility/source/rtp_dump_impl.h deleted file mode 100644 index b49a690427..0000000000 --- a/webrtc/modules/utility/source/rtp_dump_impl.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ -#define WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ - -#include "webrtc/modules/utility/interface/rtp_dump.h" - -namespace webrtc { -class CriticalSectionWrapper; -class FileWrapper; -class RtpDumpImpl : public RtpDump -{ -public: - RtpDumpImpl(); - virtual ~RtpDumpImpl(); - - int32_t Start(const char* fileNameUTF8) override; - int32_t Stop() override; - bool IsActive() const override; - int32_t DumpPacket(const uint8_t* packet, size_t packetLength) override; - -private: - // Return the system time in ms. - inline uint32_t GetTimeInMS() const; - // Return x in network byte order (big endian). - inline uint32_t RtpDumpHtonl(uint32_t x) const; - // Return x in network byte order (big endian). - inline uint16_t RtpDumpHtons(uint16_t x) const; - - // Return true if the packet starts with a valid RTCP header. - // Note: See RtpUtility::RtpHeaderParser::RTCP() for details on how - // to determine if the packet is an RTCP packet. - bool RTCP(const uint8_t* packet) const; - -private: - CriticalSectionWrapper* _critSect; - FileWrapper& _file; - uint32_t _startTime; -}; -} // namespace webrtc -#endif // WEBRTC_MODULES_UTILITY_SOURCE_RTP_DUMP_IMPL_H_ diff --git a/webrtc/modules/utility/utility.gypi b/webrtc/modules/utility/utility.gypi index 51ee624e3a..1a203bf773 100644 --- a/webrtc/modules/utility/utility.gypi +++ b/webrtc/modules/utility/utility.gypi @@ -24,7 +24,6 @@ 'interface/helpers_android.h', 'interface/jvm_android.h', 'interface/process_thread.h', - 'interface/rtp_dump.h', 'source/audio_frame_operations.cc', 'source/coder.cc', 'source/coder.h', @@ -36,8 +35,6 @@ 'source/jvm_android.cc', 'source/process_thread_impl.cc', 'source/process_thread_impl.h', - 'source/rtp_dump_impl.cc', - 'source/rtp_dump_impl.h', ], }, ], # targets diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 86fe598aed..880acf2eb6 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -105,7 +105,6 @@ ViEChannel::ViEChannel(int32_t channel_id, nullptr, nullptr)), vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this), - vie_sender_(channel_id), vie_sync_(vcm_, this), stats_observer_(new ChannelStatsObserver(this)), vcm_receive_stats_callback_(NULL), @@ -1294,23 +1293,6 @@ void ViEChannel::RegisterSendBitrateObserver( send_bitrate_observer_.Set(observer); } -int32_t ViEChannel::StartRTPDump(const char file_nameUTF8[1024], - RTPDirections direction) { - if (direction == kRtpIncoming) { - return vie_receiver_.StartRTPDump(file_nameUTF8); - } else { - return vie_sender_.StartRTPDump(file_nameUTF8); - } -} - -int32_t ViEChannel::StopRTPDump(RTPDirections direction) { - if (direction == kRtpIncoming) { - return vie_receiver_.StopRTPDump(); - } else { - return vie_sender_.StopRTPDump(); - } -} - int32_t ViEChannel::StartSend() { CriticalSectionScoped cs(callback_cs_.get()); if (!external_transport_) { diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 05550caa8e..1ba6417168 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -248,10 +248,6 @@ class ViEChannel // Called on any new send bitrate estimate. void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer); - int32_t StartRTPDump(const char file_nameUTF8[1024], - RTPDirections direction); - int32_t StopRTPDump(RTPDirections direction); - // Implements RtpFeedback. virtual int32_t OnInitializeDecoder( const int32_t id, diff --git a/webrtc/video_engine/vie_receiver.cc b/webrtc/video_engine/vie_receiver.cc index 2cf5678032..dcdacd68ff 100644 --- a/webrtc/video_engine/vie_receiver.cc +++ b/webrtc/video_engine/vie_receiver.cc @@ -21,7 +21,6 @@ #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" -#include "webrtc/modules/utility/interface/rtp_dump.h" #include "webrtc/modules/video_coding/main/interface/video_coding.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/logging.h" @@ -55,7 +54,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id, vcm_(module_vcm), remote_bitrate_estimator_(remote_bitrate_estimator), ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), - rtp_dump_(NULL), receiving_(false), restored_packet_in_use_(false), receiving_ast_enabled_(false), @@ -66,11 +64,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id, ViEReceiver::~ViEReceiver() { UpdateHistograms(); - if (rtp_dump_) { - rtp_dump_->Stop(); - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - } } void ViEReceiver::UpdateHistograms() { @@ -254,9 +247,6 @@ int ViEReceiver::InsertRTPPacket(const uint8_t* rtp_packet, if (!receiving_) { return -1; } - if (rtp_dump_) { - rtp_dump_->DumpPacket(rtp_packet, rtp_packet_length); - } } RTPHeader header; @@ -407,10 +397,6 @@ int ViEReceiver::InsertRTCPPacket(const uint8_t* rtcp_packet, return -1; } - if (rtp_dump_) { - rtp_dump_->DumpPacket(rtcp_packet, rtcp_packet_length); - } - std::list::iterator it = rtp_rtcp_simulcast_.begin(); while (it != rtp_rtcp_simulcast_.end()) { RtpRtcp* rtp_rtcp = *it++; @@ -452,39 +438,6 @@ void ViEReceiver::StopReceive() { receiving_ = false; } -int ViEReceiver::StartRTPDump(const char file_nameUTF8[1024]) { - CriticalSectionScoped cs(receive_cs_.get()); - if (rtp_dump_) { - // Restart it if it already exists and is started - rtp_dump_->Stop(); - } else { - rtp_dump_ = RtpDump::CreateRtpDump(); - if (rtp_dump_ == NULL) { - return -1; - } - } - if (rtp_dump_->Start(file_nameUTF8) != 0) { - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - return -1; - } - return 0; -} - -int ViEReceiver::StopRTPDump() { - CriticalSectionScoped cs(receive_cs_.get()); - if (rtp_dump_) { - if (rtp_dump_->IsActive()) { - rtp_dump_->Stop(); - } - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - } else { - return -1; - } - return 0; -} - ReceiveStatistics* ViEReceiver::GetReceiveStatistics() const { return rtp_receive_statistics_.get(); } diff --git a/webrtc/video_engine/vie_receiver.h b/webrtc/video_engine/vie_receiver.h index a1f82dfa17..8c1506fca1 100644 --- a/webrtc/video_engine/vie_receiver.h +++ b/webrtc/video_engine/vie_receiver.h @@ -27,7 +27,6 @@ class FecReceiver; class RemoteNtpTimeEstimator; class ReceiveStatistics; class RemoteBitrateEstimator; -class RtpDump; class RtpHeaderParser; class RTPPayloadRegistry; class RtpReceiver; @@ -68,9 +67,6 @@ class ViEReceiver : public RtpData { void StartReceive(); void StopReceive(); - int StartRTPDump(const char file_nameUTF8[1024]); - int StopRTPDump(); - // Receives packets from external transport. int ReceivedRTPPacket(const void* rtp_packet, size_t rtp_packet_length, const PacketTime& packet_time); @@ -115,7 +111,6 @@ class ViEReceiver : public RtpData { rtc::scoped_ptr ntp_estimator_; - RtpDump* rtp_dump_; bool receiving_; uint8_t restored_packet_[kViEMaxMtu]; bool restored_packet_in_use_; diff --git a/webrtc/video_engine/vie_sender.cc b/webrtc/video_engine/vie_sender.cc index db7a5b116d..b703e9dff3 100644 --- a/webrtc/video_engine/vie_sender.cc +++ b/webrtc/video_engine/vie_sender.cc @@ -10,28 +10,15 @@ #include "webrtc/video_engine/vie_sender.h" -#include #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" - -#include "webrtc/modules/utility/interface/rtp_dump.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/trace.h" namespace webrtc { -ViESender::ViESender(int channel_id) - : channel_id_(channel_id), - critsect_(CriticalSectionWrapper::CreateCriticalSection()), - transport_(NULL), - rtp_dump_(NULL) { -} - -ViESender::~ViESender() { - if (rtp_dump_) { - rtp_dump_->Stop(); - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - } +ViESender::ViESender() + : critsect_(CriticalSectionWrapper::CreateCriticalSection()), + transport_(NULL) { } int ViESender::RegisterSendTransport(Transport* transport) { @@ -52,66 +39,22 @@ int ViESender::DeregisterSendTransport() { return 0; } -int ViESender::StartRTPDump(const char file_nameUTF8[1024]) { - CriticalSectionScoped cs(critsect_.get()); - if (rtp_dump_) { - // Packet dump is already started, restart it. - rtp_dump_->Stop(); - } else { - rtp_dump_ = RtpDump::CreateRtpDump(); - if (rtp_dump_ == NULL) { - return -1; - } - } - if (rtp_dump_->Start(file_nameUTF8) != 0) { - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - return -1; - } - return 0; -} - -int ViESender::StopRTPDump() { - CriticalSectionScoped cs(critsect_.get()); - if (rtp_dump_) { - if (rtp_dump_->IsActive()) { - rtp_dump_->Stop(); - } - RtpDump::DestroyRtpDump(rtp_dump_); - rtp_dump_ = NULL; - } else { - return -1; - } - return 0; -} - -int ViESender::SendPacket(int vie_id, const void* data, size_t len) { +int ViESender::SendPacket(int id, const void* data, size_t len) { CriticalSectionScoped cs(critsect_.get()); if (!transport_) { // No transport return -1; } - assert(ChannelId(vie_id) == channel_id_); - - if (rtp_dump_) { - rtp_dump_->DumpPacket(static_cast(data), len); - } - - return transport_->SendPacket(channel_id_, data, len); + return transport_->SendPacket(id, data, len); } -int ViESender::SendRTCPPacket(int vie_id, const void* data, size_t len) { +int ViESender::SendRTCPPacket(int id, const void* data, size_t len) { CriticalSectionScoped cs(critsect_.get()); if (!transport_) { return -1; } - assert(ChannelId(vie_id) == channel_id_); - if (rtp_dump_) { - rtp_dump_->DumpPacket(static_cast(data), len); - } - - return transport_->SendRTCPPacket(channel_id_, data, len); + return transport_->SendRTCPPacket(id, data, len); } } // namespace webrtc diff --git a/webrtc/video_engine/vie_sender.h b/webrtc/video_engine/vie_sender.h index 3e6bd95549..1589ce0e01 100644 --- a/webrtc/video_engine/vie_sender.h +++ b/webrtc/video_engine/vie_sender.h @@ -22,34 +22,25 @@ namespace webrtc { class CriticalSectionWrapper; -class RtpDump; class Transport; class VideoCodingModule; class ViESender: public Transport { public: - explicit ViESender(const int32_t channel_id); - ~ViESender(); + ViESender(); // Registers transport to use for sending RTP and RTCP. int RegisterSendTransport(Transport* transport); int DeregisterSendTransport(); - // Stores all incoming packets to file. - int StartRTPDump(const char file_nameUTF8[1024]); - int StopRTPDump(); - // Implements Transport. int SendPacket(int vie_id, const void* data, size_t len) override; int SendRTCPPacket(int vie_id, const void* data, size_t len) override; private: - const int32_t channel_id_; - rtc::scoped_ptr critsect_; Transport* transport_; - RtpDump* rtp_dump_; }; } // namespace webrtc diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 9038d6bf56..af2c58e4e4 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -25,7 +25,6 @@ #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" #include "webrtc/modules/utility/interface/audio_frame_operations.h" #include "webrtc/modules/utility/interface/process_thread.h" -#include "webrtc/modules/utility/interface/rtp_dump.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/trace.h" @@ -245,14 +244,6 @@ Channel::SendPacket(int channel, const void *data, size_t len) uint8_t* bufferToSendPtr = (uint8_t*)data; size_t bufferLength = len; - // Dump the RTP packet to a file (if RTP dump is enabled). - if (_rtpDumpOut.DumpPacket((const uint8_t*)data, len) == -1) - { - WEBRTC_TRACE(kTraceWarning, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::SendPacket() RTP dump to output file failed"); - } - int n = _transportPtr->SendPacket(channel, bufferToSendPtr, bufferLength); if (n < 0) { @@ -290,14 +281,6 @@ Channel::SendRTCPPacket(int channel, const void *data, size_t len) uint8_t* bufferToSendPtr = (uint8_t*)data; size_t bufferLength = len; - // Dump the RTCP packet to a file (if RTP dump is enabled). - if (_rtpDumpOut.DumpPacket((const uint8_t*)data, len) == -1) - { - WEBRTC_TRACE(kTraceWarning, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::SendPacket() RTCP dump to output file failed"); - } - int n = _transportPtr->SendRTCPPacket(channel, bufferToSendPtr, bufferLength); @@ -759,8 +742,6 @@ Channel::Channel(int32_t channelId, VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, this, this, rtp_payload_registry_.get())), telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), - _rtpDumpIn(*RtpDump::CreateRtpDump()), - _rtpDumpOut(*RtpDump::CreateRtpDump()), _outputAudioLevel(), _externalTransport(false), _inputFilePlayerPtr(NULL), @@ -927,8 +908,6 @@ Channel::~Channel() // End of modules shutdown // Delete other objects - RtpDump::DestroyRtpDump(&_rtpDumpIn); - RtpDump::DestroyRtpDump(&_rtpDumpOut); delete &_callbackCritSect; delete &_fileCritSect; delete &volume_settings_critsect_; @@ -1640,13 +1619,6 @@ int32_t Channel::ReceivedRTPPacket(const int8_t* data, size_t length, // Store playout timestamp for the received RTP packet UpdatePlayoutTimestamp(false); - // Dump the RTP packet to a file (if RTP dump is enabled). - if (_rtpDumpIn.DumpPacket((const uint8_t*)data, - (uint16_t)length) == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::SendPacket() RTP dump to input file failed"); - } const uint8_t* received_packet = reinterpret_cast(data); RTPHeader header; if (!rtp_header_parser_->Parse(received_packet, length, &header)) { @@ -1745,13 +1717,6 @@ int32_t Channel::ReceivedRTCPPacket(const int8_t* data, size_t length) { // Store playout timestamp for the received RTCP packet UpdatePlayoutTimestamp(true); - // Dump the RTCP packet to a file (if RTP dump is enabled). - if (_rtpDumpIn.DumpPacket((const uint8_t*)data, length) == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceVoice, - VoEId(_instanceId,_channelId), - "Channel::SendPacket() RTCP dump to input file failed"); - } - // Deliver RTCP packet to RTP/RTCP module for parsing if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, length) == -1) { _engineStatisticsPtr->SetLastError( @@ -3372,82 +3337,6 @@ int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { return _rtpRtcpModule->SendNACK(sequence_numbers, length); } -int -Channel::StartRTPDump(const char fileNameUTF8[1024], - RTPDirections direction) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), - "Channel::StartRTPDump()"); - if ((direction != kRtpIncoming) && (direction != kRtpOutgoing)) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_ARGUMENT, kTraceError, - "StartRTPDump() invalid RTP direction"); - return -1; - } - RtpDump* rtpDumpPtr = (direction == kRtpIncoming) ? - &_rtpDumpIn : &_rtpDumpOut; - if (rtpDumpPtr == NULL) - { - assert(false); - return -1; - } - if (rtpDumpPtr->IsActive()) - { - rtpDumpPtr->Stop(); - } - if (rtpDumpPtr->Start(fileNameUTF8) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_BAD_FILE, kTraceError, - "StartRTPDump() failed to create file"); - return -1; - } - return 0; -} - -int -Channel::StopRTPDump(RTPDirections direction) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), - "Channel::StopRTPDump()"); - if ((direction != kRtpIncoming) && (direction != kRtpOutgoing)) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_ARGUMENT, kTraceError, - "StopRTPDump() invalid RTP direction"); - return -1; - } - RtpDump* rtpDumpPtr = (direction == kRtpIncoming) ? - &_rtpDumpIn : &_rtpDumpOut; - if (rtpDumpPtr == NULL) - { - assert(false); - return -1; - } - if (!rtpDumpPtr->IsActive()) - { - return 0; - } - return rtpDumpPtr->Stop(); -} - -bool -Channel::RTPDumpIsActive(RTPDirections direction) -{ - if ((direction != kRtpIncoming) && - (direction != kRtpOutgoing)) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_ARGUMENT, kTraceError, - "RTPDumpIsActive() invalid RTP direction"); - return false; - } - RtpDump* rtpDumpPtr = (direction == kRtpIncoming) ? - &_rtpDumpIn : &_rtpDumpOut; - return rtpDumpPtr->IsActive(); -} - uint32_t Channel::Demultiplex(const AudioFrame& audioFrame) { diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index ea8e4fdc5d..bb9ded9f05 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -51,7 +51,6 @@ class FileWrapper; class ProcessThread; class ReceiveStatistics; class RemoteNtpTimeEstimator; -class RtpDump; class RTPPayloadRegistry; class RtpReceiver; class RTPReceiverAudio; @@ -339,9 +338,6 @@ public: int SetCodecFECStatus(bool enable); bool GetCodecFECStatus(); void SetNACKStatus(bool enable, int maxNumberOfPackets); - int StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction); - int StopRTPDump(RTPDirections direction); - bool RTPDumpIsActive(RTPDirections direction); // From AudioPacketizationCallback in the ACM int32_t SendData(FrameType frameType, @@ -496,8 +492,6 @@ private: TelephoneEventHandler* telephone_event_handler_; rtc::scoped_ptr _rtpRtcpModule; rtc::scoped_ptr audio_coding_; - RtpDump& _rtpDumpIn; - RtpDump& _rtpDumpOut; AudioLevel _outputAudioLevel; bool _externalTransport; AudioFrame _audioFrame; diff --git a/webrtc/voice_engine/include/voe_rtp_rtcp.h b/webrtc/voice_engine/include/voe_rtp_rtcp.h index a032cf8fe3..ce96581fde 100644 --- a/webrtc/voice_engine/include/voe_rtp_rtcp.h +++ b/webrtc/voice_engine/include/voe_rtp_rtcp.h @@ -221,24 +221,6 @@ class WEBRTC_DLLEXPORT VoERTP_RTCP { // If using NACK, NACK should be enabled on both endpoints in a call. virtual int SetNACKStatus(int channel, bool enable, int maxNoPackets) = 0; - // Enables capturing of RTP packets to a binary file on a specific - // |channel| and for a given |direction|. The file can later be replayed - // using e.g. RTP Tools rtpplay since the binary file format is - // compatible with the rtpdump format. - virtual int StartRTPDump(int channel, - const char fileNameUTF8[1024], - RTPDirections direction = kRtpIncoming) = 0; - - // Disables capturing of RTP packets to a binary file on a specific - // |channel| and for a given |direction|. - virtual int StopRTPDump(int channel, - RTPDirections direction = kRtpIncoming) = 0; - - // Gets the the current RTP capturing state for the specified - // |channel| and |direction|. - virtual int RTPDumpIsActive(int channel, - RTPDirections direction = kRtpIncoming) = 0; - // Will be removed. Don't use. virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer) { return -1; diff --git a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc index e5b2f307de..236232b3d3 100644 --- a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc +++ b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc @@ -117,23 +117,3 @@ TEST_F(RtpRtcpTest, DISABLED_ON_LINUX(SSRCPropagatesCorrectly)) { EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); EXPECT_EQ(local_ssrc, ssrc); } - -// TODO(xians, phoglund): Re-enable when issue 372 is resolved. -TEST_F(RtpRtcpTest, DISABLED_CanCreateRtpDumpFilesWithoutError) { - // Create two RTP dump files (3 seconds long). You can verify these after - // the test using rtpplay or NetEqRTPplay if you like. - std::string output_path = webrtc::test::OutputPath(); - std::string incoming_filename = output_path + "dump_in_3sec.rtp"; - std::string outgoing_filename = output_path + "dump_out_3sec.rtp"; - - EXPECT_EQ(0, voe_rtp_rtcp_->StartRTPDump( - channel_, incoming_filename.c_str(), webrtc::kRtpIncoming)); - EXPECT_EQ(0, voe_rtp_rtcp_->StartRTPDump( - channel_, outgoing_filename.c_str(), webrtc::kRtpOutgoing)); - - Sleep(3000); - - EXPECT_EQ(0, voe_rtp_rtcp_->StopRTPDump(channel_, webrtc::kRtpIncoming)); - EXPECT_EQ(0, voe_rtp_rtcp_->StopRTPDump(channel_, webrtc::kRtpOutgoing)); -} - diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc index fa15bc895b..c98dd90522 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc @@ -444,61 +444,6 @@ int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { return 0; } -int VoERTP_RTCPImpl::StartRTPDump(int channel, - const char fileNameUTF8[1024], - RTPDirections direction) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)", - channel, fileNameUTF8, direction); - static_assert(1024 == FileWrapper::kMaxFileNameSize, ""); - if (!_shared->statistics().Initialized()) { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "StartRTPDump() failed to locate channel"); - return -1; - } - return channelPtr->StartRTPDump(fileNameUTF8, direction); -} - -int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "StopRTPDump(channel=%d, direction=%d)", channel, direction); - if (!_shared->statistics().Initialized()) { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "StopRTPDump() failed to locate channel"); - return -1; - } - return channelPtr->StopRTPDump(direction); -} - -int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "RTPDumpIsActive(channel=%d, direction=%d)", channel, direction); - if (!_shared->statistics().Initialized()) { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "StopRTPDump() failed to locate channel"); - return -1; - } - return channelPtr->RTPDumpIsActive(direction); -} - #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API } // namespace webrtc diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.h b/webrtc/voice_engine/voe_rtp_rtcp_impl.h index 1d0978d335..4d4c70176b 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.h +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.h @@ -79,16 +79,6 @@ class VoERTP_RTCPImpl : public VoERTP_RTCP { // NACK int SetNACKStatus(int channel, bool enable, int maxNoPackets) override; - // Store RTP and RTCP packets and dump to file (compatible with rtpplay) - int StartRTPDump(int channel, - const char fileNameUTF8[1024], - RTPDirections direction = kRtpIncoming) override; - - int StopRTPDump(int channel, RTPDirections direction = kRtpIncoming) override; - - int RTPDumpIsActive(int channel, - RTPDirections direction = kRtpIncoming) override; - protected: VoERTP_RTCPImpl(voe::SharedData* shared); ~VoERTP_RTCPImpl() override;