OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( | 41 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( |
42 kDefaultRedPayloadType, "RED", webrtc::kVideoCodecRED)); | 42 kDefaultRedPayloadType, "RED", webrtc::kVideoCodecRED)); |
43 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( | 43 payload_types.push_back(webrtc::rtpplayer::PayloadCodecTuple( |
44 kDefaultVp8PayloadType, "VP8", webrtc::kVideoCodecVP8)); | 44 kDefaultVp8PayloadType, "VP8", webrtc::kVideoCodecVP8)); |
45 | 45 |
46 std::string output_file = args.outputFile; | 46 std::string output_file = args.outputFile; |
47 if (output_file.empty()) | 47 if (output_file.empty()) |
48 output_file = webrtc::test::OutputPath() + "RtpPlay_decoded.yuv"; | 48 output_file = webrtc::test::OutputPath() + "RtpPlay_decoded.yuv"; |
49 | 49 |
50 webrtc::SimulatedClock clock(0); | 50 webrtc::SimulatedClock clock(0); |
51 webrtc::rtpplayer::VcmPayloadSinkFactory factory(output_file, &clock, | 51 webrtc::rtpplayer::VcmPayloadSinkFactory factory( |
52 kConfigProtectionEnabled, kConfigProtectionMethod, kConfigRttMs, | 52 output_file, &clock, kConfigProtectionEnabled, kConfigProtectionMethod, |
53 kConfigRenderDelayMs, kConfigMinPlayoutDelayMs); | 53 kConfigRttMs, kConfigRenderDelayMs, kConfigMinPlayoutDelayMs); |
54 rtc::scoped_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player( | 54 rtc::scoped_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player( |
55 webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types, | 55 webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types, |
56 kConfigLossRate, kConfigRttMs, | 56 kConfigLossRate, kConfigRttMs, |
57 kConfigReordering)); | 57 kConfigReordering)); |
58 if (rtp_player.get() == NULL) { | 58 if (rtp_player.get() == NULL) { |
59 return -1; | 59 return -1; |
60 } | 60 } |
61 | 61 |
62 int ret = 0; | 62 int ret = 0; |
63 while ((ret = rtp_player->NextPacket(clock.TimeInMilliseconds())) == 0) { | 63 while ((ret = rtp_player->NextPacket(clock.TimeInMilliseconds())) == 0) { |
64 ret = factory.DecodeAndProcessAll(true); | 64 ret = factory.DecodeAndProcessAll(true); |
65 if (ret < 0 || (kConfigMaxRuntimeMs > -1 && | 65 if (ret < 0 || (kConfigMaxRuntimeMs > -1 && |
66 clock.TimeInMilliseconds() >= kConfigMaxRuntimeMs)) { | 66 clock.TimeInMilliseconds() >= kConfigMaxRuntimeMs)) { |
67 break; | 67 break; |
68 } | 68 } |
69 clock.AdvanceTimeMilliseconds(1); | 69 clock.AdvanceTimeMilliseconds(1); |
70 } | 70 } |
71 | 71 |
72 rtp_player->Print(); | 72 rtp_player->Print(); |
73 | 73 |
74 switch (ret) { | 74 switch (ret) { |
75 case 1: | 75 case 1: |
76 printf("Success\n"); | 76 printf("Success\n"); |
77 return 0; | 77 return 0; |
78 case -1: | 78 case -1: |
79 printf("Failed\n"); | 79 printf("Failed\n"); |
80 return -1; | 80 return -1; |
81 case 0: | 81 case 0: |
82 printf("Timeout\n"); | 82 printf("Timeout\n"); |
83 return -1; | 83 return -1; |
84 } | 84 } |
85 | 85 |
86 webrtc::Trace::ReturnTrace(); | 86 webrtc::Trace::ReturnTrace(); |
87 return 0; | 87 return 0; |
88 } | 88 } |
OLD | NEW |