| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ |
| 13 | 13 |
| 14 #include <map> |
| 14 #include <string> | 15 #include <string> |
| 15 | 16 |
| 16 #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h" | 17 #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h" |
| 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 17 | 19 |
| 18 namespace webrtc { | 20 namespace webrtc { |
| 19 namespace test { | 21 namespace test { |
| 20 | 22 |
| 21 class RtpFileSource; | 23 class RtpFileSource; |
| 22 class RtcEventLogSource; | 24 class RtcEventLogSource; |
| 23 | 25 |
| 24 // An adapter class to dress up a PacketSource object as a NetEqInput. | 26 // An adapter class to dress up a PacketSource object as a NetEqInput. |
| 25 class NetEqPacketSourceInput : public NetEqInput { | 27 class NetEqPacketSourceInput : public NetEqInput { |
| 26 public: | 28 public: |
| 29 using RtpHeaderExtensionMap = std::map<int, webrtc::RTPExtensionType>; |
| 30 |
| 27 NetEqPacketSourceInput(); | 31 NetEqPacketSourceInput(); |
| 28 rtc::Optional<int64_t> NextPacketTime() const override; | 32 rtc::Optional<int64_t> NextPacketTime() const override; |
| 29 std::unique_ptr<PacketData> PopPacket() override; | 33 std::unique_ptr<PacketData> PopPacket() override; |
| 30 rtc::Optional<RTPHeader> NextHeader() const override; | 34 rtc::Optional<RTPHeader> NextHeader() const override; |
| 31 bool ended() const override { return !next_output_event_ms_; } | 35 bool ended() const override { return !next_output_event_ms_; } |
| 32 | 36 |
| 33 protected: | 37 protected: |
| 34 virtual PacketSource* source() = 0; | 38 virtual PacketSource* source() = 0; |
| 35 void LoadNextPacket(); | 39 void LoadNextPacket(); |
| 36 | 40 |
| 37 rtc::Optional<int64_t> next_output_event_ms_; | 41 rtc::Optional<int64_t> next_output_event_ms_; |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 std::unique_ptr<Packet> packet_; | 44 std::unique_ptr<Packet> packet_; |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 // Implementation of NetEqPacketSourceInput to be used with an RtpFileSource. | 47 // Implementation of NetEqPacketSourceInput to be used with an RtpFileSource. |
| 44 class NetEqRtpDumpInput final : public NetEqPacketSourceInput { | 48 class NetEqRtpDumpInput final : public NetEqPacketSourceInput { |
| 45 public: | 49 public: |
| 46 explicit NetEqRtpDumpInput(const std::string& file_name); | 50 NetEqRtpDumpInput(const std::string& file_name, |
| 51 const RtpHeaderExtensionMap& hdr_ext_map); |
| 47 | 52 |
| 48 rtc::Optional<int64_t> NextOutputEventTime() const override; | 53 rtc::Optional<int64_t> NextOutputEventTime() const override; |
| 49 void AdvanceOutputEvent() override; | 54 void AdvanceOutputEvent() override; |
| 50 | 55 |
| 51 protected: | 56 protected: |
| 52 PacketSource* source() override; | 57 PacketSource* source() override; |
| 53 | 58 |
| 54 private: | 59 private: |
| 55 static constexpr int64_t kOutputPeriodMs = 10; | 60 static constexpr int64_t kOutputPeriodMs = 10; |
| 56 | 61 |
| 57 std::unique_ptr<RtpFileSource> source_; | 62 std::unique_ptr<RtpFileSource> source_; |
| 58 }; | 63 }; |
| 59 | 64 |
| 60 // Implementation of NetEqPacketSourceInput to be used with an | 65 // Implementation of NetEqPacketSourceInput to be used with an |
| 61 // RtcEventLogSource. | 66 // RtcEventLogSource. |
| 62 class NetEqEventLogInput final : public NetEqPacketSourceInput { | 67 class NetEqEventLogInput final : public NetEqPacketSourceInput { |
| 63 public: | 68 public: |
| 64 explicit NetEqEventLogInput(const std::string& file_name); | 69 NetEqEventLogInput(const std::string& file_name, |
| 70 const RtpHeaderExtensionMap& hdr_ext_map); |
| 65 | 71 |
| 66 rtc::Optional<int64_t> NextOutputEventTime() const override; | 72 rtc::Optional<int64_t> NextOutputEventTime() const override; |
| 67 void AdvanceOutputEvent() override; | 73 void AdvanceOutputEvent() override; |
| 68 | 74 |
| 69 protected: | 75 protected: |
| 70 PacketSource* source() override; | 76 PacketSource* source() override; |
| 71 | 77 |
| 72 private: | 78 private: |
| 73 std::unique_ptr<RtcEventLogSource> source_; | 79 std::unique_ptr<RtcEventLogSource> source_; |
| 74 }; | 80 }; |
| 75 | 81 |
| 76 } // namespace test | 82 } // namespace test |
| 77 } // namespace webrtc | 83 } // namespace webrtc |
| 78 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ | 84 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_PACKET_SOURCE_INPUT_H_ |
| OLD | NEW |