Remove rtp_rtcp/ dump functionality.
Removes RTP dumping from VideoEngine and VoiceEngine. BUG=1695 R=henrika@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/47179004 Cr-Commit-Position: refs/heads/master@{#9234}
This commit is contained in:
		| @@ -1035,10 +1035,6 @@ class FakeWebRtcVoiceEngine | |||||||
|     channels_[channel]->nack_max_packets = maxNoPackets; |     channels_[channel]->nack_max_packets = maxNoPackets; | ||||||
|     return 0; |     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, |   WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType, | ||||||
|                                      bool markerBit, const char* payloadData, |                                      bool markerBit, const char* payloadData, | ||||||
|                                      unsigned short payloadSize)); |                                      unsigned short payloadSize)); | ||||||
|   | |||||||
| @@ -400,22 +400,6 @@ JOWW(jint, VoiceEngine_stopDebugRecording)(JNIEnv* jni, jobject j_voe) { | |||||||
|   return voe_data->apm->StopDebugRecording(); |   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<webrtc::RTPDirections>(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<webrtc::RTPDirections>(direction)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| JOWW(void, CodecInst_dispose)(JNIEnv* jni, jobject j_codec) { | JOWW(void, CodecInst_dispose)(JNIEnv* jni, jobject j_codec) { | ||||||
|   delete GetCodecInst(jni, j_codec); |   delete GetCodecInst(jni, j_codec); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ source_set("utility") { | |||||||
|     "interface/helpers_android.h", |     "interface/helpers_android.h", | ||||||
|     "interface/jvm_android.h", |     "interface/jvm_android.h", | ||||||
|     "interface/process_thread.h", |     "interface/process_thread.h", | ||||||
|     "interface/rtp_dump.h", |  | ||||||
|     "source/audio_frame_operations.cc", |     "source/audio_frame_operations.cc", | ||||||
|     "source/coder.cc", |     "source/coder.cc", | ||||||
|     "source/coder.h", |     "source/coder.h", | ||||||
| @@ -28,8 +27,6 @@ source_set("utility") { | |||||||
|     "source/jvm_android.cc", |     "source/jvm_android.cc", | ||||||
|     "source/process_thread_impl.cc", |     "source/process_thread_impl.cc", | ||||||
|     "source/process_thread_impl.h", |     "source/process_thread_impl.h", | ||||||
|     "source/rtp_dump_impl.cc", |  | ||||||
|     "source/rtp_dump_impl.h", |  | ||||||
|   ] |   ] | ||||||
|  |  | ||||||
|   configs += [ "../..:common_config" ] |   configs += [ "../..:common_config" ] | ||||||
|   | |||||||
| @@ -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_ |  | ||||||
| @@ -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 <assert.h> |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <limits> |  | ||||||
|  |  | ||||||
| #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |  | ||||||
| #include "webrtc/system_wrappers/interface/logging.h" |  | ||||||
|  |  | ||||||
| #if defined(_WIN32) |  | ||||||
| #include <Windows.h> |  | ||||||
| #include <mmsystem.h> |  | ||||||
| #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |  | ||||||
| #include <string.h> |  | ||||||
| #include <sys/time.h> |  | ||||||
| #include <time.h> |  | ||||||
| #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<uint16_t>::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 |  | ||||||
| @@ -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_ |  | ||||||
| @@ -24,7 +24,6 @@ | |||||||
|         'interface/helpers_android.h', |         'interface/helpers_android.h', | ||||||
|         'interface/jvm_android.h', |         'interface/jvm_android.h', | ||||||
|         'interface/process_thread.h', |         'interface/process_thread.h', | ||||||
|         'interface/rtp_dump.h', |  | ||||||
|         'source/audio_frame_operations.cc', |         'source/audio_frame_operations.cc', | ||||||
|         'source/coder.cc', |         'source/coder.cc', | ||||||
|         'source/coder.h', |         'source/coder.h', | ||||||
| @@ -36,8 +35,6 @@ | |||||||
|         'source/jvm_android.cc', |         'source/jvm_android.cc', | ||||||
|         'source/process_thread_impl.cc', |         'source/process_thread_impl.cc', | ||||||
|         'source/process_thread_impl.h', |         'source/process_thread_impl.h', | ||||||
|         'source/rtp_dump_impl.cc', |  | ||||||
|         'source/rtp_dump_impl.h', |  | ||||||
|       ], |       ], | ||||||
|     }, |     }, | ||||||
|   ], # targets |   ], # targets | ||||||
|   | |||||||
| @@ -105,7 +105,6 @@ ViEChannel::ViEChannel(int32_t channel_id, | |||||||
|                                      nullptr, |                                      nullptr, | ||||||
|                                      nullptr)), |                                      nullptr)), | ||||||
|       vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this), |       vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this), | ||||||
|       vie_sender_(channel_id), |  | ||||||
|       vie_sync_(vcm_, this), |       vie_sync_(vcm_, this), | ||||||
|       stats_observer_(new ChannelStatsObserver(this)), |       stats_observer_(new ChannelStatsObserver(this)), | ||||||
|       vcm_receive_stats_callback_(NULL), |       vcm_receive_stats_callback_(NULL), | ||||||
| @@ -1294,23 +1293,6 @@ void ViEChannel::RegisterSendBitrateObserver( | |||||||
|   send_bitrate_observer_.Set(observer); |   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() { | int32_t ViEChannel::StartSend() { | ||||||
|   CriticalSectionScoped cs(callback_cs_.get()); |   CriticalSectionScoped cs(callback_cs_.get()); | ||||||
|   if (!external_transport_) { |   if (!external_transport_) { | ||||||
|   | |||||||
| @@ -248,10 +248,6 @@ class ViEChannel | |||||||
|   // Called on any new send bitrate estimate. |   // Called on any new send bitrate estimate. | ||||||
|   void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer); |   void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer); | ||||||
|  |  | ||||||
|   int32_t StartRTPDump(const char file_nameUTF8[1024], |  | ||||||
|                        RTPDirections direction); |  | ||||||
|   int32_t StopRTPDump(RTPDirections direction); |  | ||||||
|  |  | ||||||
|   // Implements RtpFeedback. |   // Implements RtpFeedback. | ||||||
|   virtual int32_t OnInitializeDecoder( |   virtual int32_t OnInitializeDecoder( | ||||||
|       const int32_t id, |       const int32_t id, | ||||||
|   | |||||||
| @@ -21,7 +21,6 @@ | |||||||
| #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" | #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_receiver.h" | ||||||
| #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.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/modules/video_coding/main/interface/video_coding.h" | ||||||
| #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | ||||||
| #include "webrtc/system_wrappers/interface/logging.h" | #include "webrtc/system_wrappers/interface/logging.h" | ||||||
| @@ -55,7 +54,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id, | |||||||
|       vcm_(module_vcm), |       vcm_(module_vcm), | ||||||
|       remote_bitrate_estimator_(remote_bitrate_estimator), |       remote_bitrate_estimator_(remote_bitrate_estimator), | ||||||
|       ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), |       ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), | ||||||
|       rtp_dump_(NULL), |  | ||||||
|       receiving_(false), |       receiving_(false), | ||||||
|       restored_packet_in_use_(false), |       restored_packet_in_use_(false), | ||||||
|       receiving_ast_enabled_(false), |       receiving_ast_enabled_(false), | ||||||
| @@ -66,11 +64,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id, | |||||||
|  |  | ||||||
| ViEReceiver::~ViEReceiver() { | ViEReceiver::~ViEReceiver() { | ||||||
|   UpdateHistograms(); |   UpdateHistograms(); | ||||||
|   if (rtp_dump_) { |  | ||||||
|     rtp_dump_->Stop(); |  | ||||||
|     RtpDump::DestroyRtpDump(rtp_dump_); |  | ||||||
|     rtp_dump_ = NULL; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void ViEReceiver::UpdateHistograms() { | void ViEReceiver::UpdateHistograms() { | ||||||
| @@ -254,9 +247,6 @@ int ViEReceiver::InsertRTPPacket(const uint8_t* rtp_packet, | |||||||
|     if (!receiving_) { |     if (!receiving_) { | ||||||
|       return -1; |       return -1; | ||||||
|     } |     } | ||||||
|     if (rtp_dump_) { |  | ||||||
|       rtp_dump_->DumpPacket(rtp_packet, rtp_packet_length); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   RTPHeader header; |   RTPHeader header; | ||||||
| @@ -407,10 +397,6 @@ int ViEReceiver::InsertRTCPPacket(const uint8_t* rtcp_packet, | |||||||
|       return -1; |       return -1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (rtp_dump_) { |  | ||||||
|       rtp_dump_->DumpPacket(rtcp_packet, rtcp_packet_length); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     std::list<RtpRtcp*>::iterator it = rtp_rtcp_simulcast_.begin(); |     std::list<RtpRtcp*>::iterator it = rtp_rtcp_simulcast_.begin(); | ||||||
|     while (it != rtp_rtcp_simulcast_.end()) { |     while (it != rtp_rtcp_simulcast_.end()) { | ||||||
|       RtpRtcp* rtp_rtcp = *it++; |       RtpRtcp* rtp_rtcp = *it++; | ||||||
| @@ -452,39 +438,6 @@ void ViEReceiver::StopReceive() { | |||||||
|   receiving_ = false; |   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 { | ReceiveStatistics* ViEReceiver::GetReceiveStatistics() const { | ||||||
|   return rtp_receive_statistics_.get(); |   return rtp_receive_statistics_.get(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -27,7 +27,6 @@ class FecReceiver; | |||||||
| class RemoteNtpTimeEstimator; | class RemoteNtpTimeEstimator; | ||||||
| class ReceiveStatistics; | class ReceiveStatistics; | ||||||
| class RemoteBitrateEstimator; | class RemoteBitrateEstimator; | ||||||
| class RtpDump; |  | ||||||
| class RtpHeaderParser; | class RtpHeaderParser; | ||||||
| class RTPPayloadRegistry; | class RTPPayloadRegistry; | ||||||
| class RtpReceiver; | class RtpReceiver; | ||||||
| @@ -68,9 +67,6 @@ class ViEReceiver : public RtpData { | |||||||
|   void StartReceive(); |   void StartReceive(); | ||||||
|   void StopReceive(); |   void StopReceive(); | ||||||
|  |  | ||||||
|   int StartRTPDump(const char file_nameUTF8[1024]); |  | ||||||
|   int StopRTPDump(); |  | ||||||
|  |  | ||||||
|   // Receives packets from external transport. |   // Receives packets from external transport. | ||||||
|   int ReceivedRTPPacket(const void* rtp_packet, size_t rtp_packet_length, |   int ReceivedRTPPacket(const void* rtp_packet, size_t rtp_packet_length, | ||||||
|                         const PacketTime& packet_time); |                         const PacketTime& packet_time); | ||||||
| @@ -115,7 +111,6 @@ class ViEReceiver : public RtpData { | |||||||
|  |  | ||||||
|   rtc::scoped_ptr<RemoteNtpTimeEstimator> ntp_estimator_; |   rtc::scoped_ptr<RemoteNtpTimeEstimator> ntp_estimator_; | ||||||
|  |  | ||||||
|   RtpDump* rtp_dump_; |  | ||||||
|   bool receiving_; |   bool receiving_; | ||||||
|   uint8_t restored_packet_[kViEMaxMtu]; |   uint8_t restored_packet_[kViEMaxMtu]; | ||||||
|   bool restored_packet_in_use_; |   bool restored_packet_in_use_; | ||||||
|   | |||||||
| @@ -10,28 +10,15 @@ | |||||||
|  |  | ||||||
| #include "webrtc/video_engine/vie_sender.h" | #include "webrtc/video_engine/vie_sender.h" | ||||||
|  |  | ||||||
| #include <assert.h> |  | ||||||
| #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | #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/critical_section_wrapper.h" | ||||||
| #include "webrtc/system_wrappers/interface/trace.h" | #include "webrtc/system_wrappers/interface/trace.h" | ||||||
|  |  | ||||||
| namespace webrtc { | namespace webrtc { | ||||||
|  |  | ||||||
| ViESender::ViESender(int channel_id) | ViESender::ViESender() | ||||||
|     : channel_id_(channel_id), |     : critsect_(CriticalSectionWrapper::CreateCriticalSection()), | ||||||
|       critsect_(CriticalSectionWrapper::CreateCriticalSection()), |       transport_(NULL) { | ||||||
|       transport_(NULL), |  | ||||||
|       rtp_dump_(NULL) { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| ViESender::~ViESender() { |  | ||||||
|   if (rtp_dump_) { |  | ||||||
|     rtp_dump_->Stop(); |  | ||||||
|     RtpDump::DestroyRtpDump(rtp_dump_); |  | ||||||
|     rtp_dump_ = NULL; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| int ViESender::RegisterSendTransport(Transport* transport) { | int ViESender::RegisterSendTransport(Transport* transport) { | ||||||
| @@ -52,66 +39,22 @@ int ViESender::DeregisterSendTransport() { | |||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| int ViESender::StartRTPDump(const char file_nameUTF8[1024]) { | int ViESender::SendPacket(int id, const void* data, size_t len) { | ||||||
|   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) { |  | ||||||
|   CriticalSectionScoped cs(critsect_.get()); |   CriticalSectionScoped cs(critsect_.get()); | ||||||
|   if (!transport_) { |   if (!transport_) { | ||||||
|     // No transport |     // No transport | ||||||
|     return -1; |     return -1; | ||||||
|   } |   } | ||||||
|   assert(ChannelId(vie_id) == channel_id_); |   return transport_->SendPacket(id, data, len); | ||||||
|  |  | ||||||
|   if (rtp_dump_) { |  | ||||||
|     rtp_dump_->DumpPacket(static_cast<const uint8_t*>(data), len); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return transport_->SendPacket(channel_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()); |   CriticalSectionScoped cs(critsect_.get()); | ||||||
|   if (!transport_) { |   if (!transport_) { | ||||||
|     return -1; |     return -1; | ||||||
|   } |   } | ||||||
|   assert(ChannelId(vie_id) == channel_id_); |  | ||||||
|  |  | ||||||
|   if (rtp_dump_) { |   return transport_->SendRTCPPacket(id, data, len); | ||||||
|     rtp_dump_->DumpPacket(static_cast<const uint8_t*>(data), len); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return transport_->SendRTCPPacket(channel_id_, data, len); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| }  // namespace webrtc | }  // namespace webrtc | ||||||
|   | |||||||
| @@ -22,34 +22,25 @@ | |||||||
| namespace webrtc { | namespace webrtc { | ||||||
|  |  | ||||||
| class CriticalSectionWrapper; | class CriticalSectionWrapper; | ||||||
| class RtpDump; |  | ||||||
| class Transport; | class Transport; | ||||||
| class VideoCodingModule; | class VideoCodingModule; | ||||||
|  |  | ||||||
| class ViESender: public Transport { | class ViESender: public Transport { | ||||||
|  public: |  public: | ||||||
|   explicit ViESender(const int32_t channel_id); |   ViESender(); | ||||||
|   ~ViESender(); |  | ||||||
|  |  | ||||||
|   // Registers transport to use for sending RTP and RTCP. |   // Registers transport to use for sending RTP and RTCP. | ||||||
|   int RegisterSendTransport(Transport* transport); |   int RegisterSendTransport(Transport* transport); | ||||||
|   int DeregisterSendTransport(); |   int DeregisterSendTransport(); | ||||||
|  |  | ||||||
|   // Stores all incoming packets to file. |  | ||||||
|   int StartRTPDump(const char file_nameUTF8[1024]); |  | ||||||
|   int StopRTPDump(); |  | ||||||
|  |  | ||||||
|   // Implements Transport. |   // Implements Transport. | ||||||
|   int SendPacket(int vie_id, const void* data, size_t len) override; |   int SendPacket(int vie_id, const void* data, size_t len) override; | ||||||
|   int SendRTCPPacket(int vie_id, const void* data, size_t len) override; |   int SendRTCPPacket(int vie_id, const void* data, size_t len) override; | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   const int32_t channel_id_; |  | ||||||
|  |  | ||||||
|   rtc::scoped_ptr<CriticalSectionWrapper> critsect_; |   rtc::scoped_ptr<CriticalSectionWrapper> critsect_; | ||||||
|  |  | ||||||
|   Transport* transport_; |   Transport* transport_; | ||||||
|   RtpDump* rtp_dump_; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| }  // namespace webrtc | }  // namespace webrtc | ||||||
|   | |||||||
| @@ -25,7 +25,6 @@ | |||||||
| #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | ||||||
| #include "webrtc/modules/utility/interface/audio_frame_operations.h" | #include "webrtc/modules/utility/interface/audio_frame_operations.h" | ||||||
| #include "webrtc/modules/utility/interface/process_thread.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/critical_section_wrapper.h" | ||||||
| #include "webrtc/system_wrappers/interface/logging.h" | #include "webrtc/system_wrappers/interface/logging.h" | ||||||
| #include "webrtc/system_wrappers/interface/trace.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; |     uint8_t* bufferToSendPtr = (uint8_t*)data; | ||||||
|     size_t bufferLength = len; |     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, |     int n = _transportPtr->SendPacket(channel, bufferToSendPtr, | ||||||
|                                       bufferLength); |                                       bufferLength); | ||||||
|     if (n < 0) { |     if (n < 0) { | ||||||
| @@ -290,14 +281,6 @@ Channel::SendRTCPPacket(int channel, const void *data, size_t len) | |||||||
|     uint8_t* bufferToSendPtr = (uint8_t*)data; |     uint8_t* bufferToSendPtr = (uint8_t*)data; | ||||||
|     size_t bufferLength = len; |     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, |     int n = _transportPtr->SendRTCPPacket(channel, | ||||||
|                                           bufferToSendPtr, |                                           bufferToSendPtr, | ||||||
|                                           bufferLength); |                                           bufferLength); | ||||||
| @@ -759,8 +742,6 @@ Channel::Channel(int32_t channelId, | |||||||
|         VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, |         VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, | ||||||
|         this, this, rtp_payload_registry_.get())), |         this, this, rtp_payload_registry_.get())), | ||||||
|     telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |     telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | ||||||
|     _rtpDumpIn(*RtpDump::CreateRtpDump()), |  | ||||||
|     _rtpDumpOut(*RtpDump::CreateRtpDump()), |  | ||||||
|     _outputAudioLevel(), |     _outputAudioLevel(), | ||||||
|     _externalTransport(false), |     _externalTransport(false), | ||||||
|     _inputFilePlayerPtr(NULL), |     _inputFilePlayerPtr(NULL), | ||||||
| @@ -927,8 +908,6 @@ Channel::~Channel() | |||||||
|     // End of modules shutdown |     // End of modules shutdown | ||||||
|  |  | ||||||
|     // Delete other objects |     // Delete other objects | ||||||
|     RtpDump::DestroyRtpDump(&_rtpDumpIn); |  | ||||||
|     RtpDump::DestroyRtpDump(&_rtpDumpOut); |  | ||||||
|     delete &_callbackCritSect; |     delete &_callbackCritSect; | ||||||
|     delete &_fileCritSect; |     delete &_fileCritSect; | ||||||
|     delete &volume_settings_critsect_; |     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 |   // Store playout timestamp for the received RTP packet | ||||||
|   UpdatePlayoutTimestamp(false); |   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<const uint8_t*>(data); |   const uint8_t* received_packet = reinterpret_cast<const uint8_t*>(data); | ||||||
|   RTPHeader header; |   RTPHeader header; | ||||||
|   if (!rtp_header_parser_->Parse(received_packet, length, &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 |   // Store playout timestamp for the received RTCP packet | ||||||
|   UpdatePlayoutTimestamp(true); |   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 |   // Deliver RTCP packet to RTP/RTCP module for parsing | ||||||
|   if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, length) == -1) { |   if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, length) == -1) { | ||||||
|     _engineStatisticsPtr->SetLastError( |     _engineStatisticsPtr->SetLastError( | ||||||
| @@ -3372,82 +3337,6 @@ int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { | |||||||
|   return _rtpRtcpModule->SendNACK(sequence_numbers, 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 | uint32_t | ||||||
| Channel::Demultiplex(const AudioFrame& audioFrame) | Channel::Demultiplex(const AudioFrame& audioFrame) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -51,7 +51,6 @@ class FileWrapper; | |||||||
| class ProcessThread; | class ProcessThread; | ||||||
| class ReceiveStatistics; | class ReceiveStatistics; | ||||||
| class RemoteNtpTimeEstimator; | class RemoteNtpTimeEstimator; | ||||||
| class RtpDump; |  | ||||||
| class RTPPayloadRegistry; | class RTPPayloadRegistry; | ||||||
| class RtpReceiver; | class RtpReceiver; | ||||||
| class RTPReceiverAudio; | class RTPReceiverAudio; | ||||||
| @@ -339,9 +338,6 @@ public: | |||||||
|     int SetCodecFECStatus(bool enable); |     int SetCodecFECStatus(bool enable); | ||||||
|     bool GetCodecFECStatus(); |     bool GetCodecFECStatus(); | ||||||
|     void SetNACKStatus(bool enable, int maxNumberOfPackets); |     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 |     // From AudioPacketizationCallback in the ACM | ||||||
|     int32_t SendData(FrameType frameType, |     int32_t SendData(FrameType frameType, | ||||||
| @@ -496,8 +492,6 @@ private: | |||||||
|     TelephoneEventHandler* telephone_event_handler_; |     TelephoneEventHandler* telephone_event_handler_; | ||||||
|     rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule; |     rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule; | ||||||
|     rtc::scoped_ptr<AudioCodingModule> audio_coding_; |     rtc::scoped_ptr<AudioCodingModule> audio_coding_; | ||||||
|     RtpDump& _rtpDumpIn; |  | ||||||
|     RtpDump& _rtpDumpOut; |  | ||||||
|     AudioLevel _outputAudioLevel; |     AudioLevel _outputAudioLevel; | ||||||
|     bool _externalTransport; |     bool _externalTransport; | ||||||
|     AudioFrame _audioFrame; |     AudioFrame _audioFrame; | ||||||
|   | |||||||
| @@ -221,24 +221,6 @@ class WEBRTC_DLLEXPORT VoERTP_RTCP { | |||||||
|   // If using NACK, NACK should be enabled on both endpoints in a call. |   // If using NACK, NACK should be enabled on both endpoints in a call. | ||||||
|   virtual int SetNACKStatus(int channel, bool enable, int maxNoPackets) = 0; |   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. |   // Will be removed. Don't use. | ||||||
|   virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer) { |   virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer) { | ||||||
|     return -1; |     return -1; | ||||||
|   | |||||||
| @@ -117,23 +117,3 @@ TEST_F(RtpRtcpTest, DISABLED_ON_LINUX(SSRCPropagatesCorrectly)) { | |||||||
|   EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); |   EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); | ||||||
|   EXPECT_EQ(local_ssrc, 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)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -444,61 +444,6 @@ int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { | |||||||
|   return 0; |   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 | #endif  // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API | ||||||
|  |  | ||||||
| }  // namespace webrtc | }  // namespace webrtc | ||||||
|   | |||||||
| @@ -79,16 +79,6 @@ class VoERTP_RTCPImpl : public VoERTP_RTCP { | |||||||
|   // NACK |   // NACK | ||||||
|   int SetNACKStatus(int channel, bool enable, int maxNoPackets) override; |   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: |  protected: | ||||||
|   VoERTP_RTCPImpl(voe::SharedData* shared); |   VoERTP_RTCPImpl(voe::SharedData* shared); | ||||||
|   ~VoERTP_RTCPImpl() override; |   ~VoERTP_RTCPImpl() override; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Peter Boström
					Peter Boström