| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "webrtc/modules/video_coding/main/test/receiver_tests.h" | |
| 12 #include "webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.h" | |
| 13 #include "webrtc/system_wrappers/include/trace.h" | |
| 14 #include "webrtc/test/testsupport/fileutils.h" | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 const bool kConfigProtectionEnabled = true; | |
| 19 const webrtc::VCMVideoProtection kConfigProtectionMethod = | |
| 20 webrtc::kProtectionNack; | |
| 21 const float kConfigLossRate = 0.0f; | |
| 22 const bool kConfigReordering = false; | |
| 23 const int64_t kConfigRttMs = 0; | |
| 24 const uint32_t kConfigRenderDelayMs = 0; | |
| 25 const uint32_t kConfigMinPlayoutDelayMs = 0; | |
| 26 const int64_t kConfigMaxRuntimeMs = -1; | |
| 27 const uint8_t kDefaultUlpFecPayloadType = 97; | |
| 28 const uint8_t kDefaultRedPayloadType = 96; | |
| 29 const uint8_t kDefaultVp8PayloadType = 100; | |
| 30 } // namespace | |
| 31 | |
| 32 int RtpPlay(const CmdArgs& args) { | |
| 33 std::string trace_file = webrtc::test::OutputPath() + "receiverTestTrace.txt"; | |
| 34 webrtc::Trace::CreateTrace(); | |
| 35 webrtc::Trace::SetTraceFile(trace_file.c_str()); | |
| 36 webrtc::Trace::set_level_filter(webrtc::kTraceAll); | |
| 37 | |
| 38 webrtc::rtpplayer::PayloadTypes payload_types; | |
| 39 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( | |
| 40 kDefaultUlpFecPayloadType, "ULPFEC", webrtc::kVideoCodecULPFEC)); | |
| 41 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( | |
| 42 kDefaultRedPayloadType, "RED", webrtc::kVideoCodecRED)); | |
| 43 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( | |
| 44 kDefaultVp8PayloadType, "VP8", webrtc::kVideoCodecVP8)); | |
| 45 | |
| 46 std::string output_file = args.outputFile; | |
| 47 if (output_file.empty()) | |
| 48 output_file = webrtc::test::OutputPath() + "RtpPlay_decoded.yuv"; | |
| 49 | |
| 50 webrtc::SimulatedClock clock(0); | |
| 51 webrtc::rtpplayer::VcmPayloadSinkFactory factory(output_file, &clock, | |
| 52 kConfigProtectionEnabled, kConfigProtectionMethod, kConfigRttMs, | |
| 53 kConfigRenderDelayMs, kConfigMinPlayoutDelayMs); | |
| 54 rtc::scoped_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player( | |
| 55 webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types, | |
| 56 kConfigLossRate, kConfigRttMs, | |
| 57 kConfigReordering)); | |
| 58 if (rtp_player.get() == NULL) { | |
| 59 return -1; | |
| 60 } | |
| 61 | |
| 62 int ret = 0; | |
| 63 while ((ret = rtp_player->NextPacket(clock.TimeInMilliseconds())) == 0) { | |
| 64 ret = factory.DecodeAndProcessAll(true); | |
| 65 if (ret < 0 || (kConfigMaxRuntimeMs > -1 && | |
| 66 clock.TimeInMilliseconds() >= kConfigMaxRuntimeMs)) { | |
| 67 break; | |
| 68 } | |
| 69 clock.AdvanceTimeMilliseconds(1); | |
| 70 } | |
| 71 | |
| 72 rtp_player->Print(); | |
| 73 | |
| 74 switch (ret) { | |
| 75 case 1: | |
| 76 printf("Success\n"); | |
| 77 return 0; | |
| 78 case -1: | |
| 79 printf("Failed\n"); | |
| 80 return -1; | |
| 81 case 0: | |
| 82 printf("Timeout\n"); | |
| 83 return -1; | |
| 84 } | |
| 85 | |
| 86 webrtc::Trace::ReturnTrace(); | |
| 87 return 0; | |
| 88 } | |
| OLD | NEW |