1 /*
2  *  Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_VCM_PAYLOAD_SINK_FACTORY_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_TEST_VCM_PAYLOAD_SINK_FACTORY_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
20 #include "webrtc/modules/video_coding/test/rtp_player.h"
21 
22 class NullEventFactory;
23 
24 namespace webrtc {
25 class Clock;
26 class CriticalSectionWrapper;
27 
28 namespace rtpplayer {
29 class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface {
30  public:
31   VcmPayloadSinkFactory(const std::string& base_out_filename,
32                         Clock* clock,
33                         bool protection_enabled,
34                         VCMVideoProtection protection_method,
35                         int64_t rtt_ms,
36                         uint32_t render_delay_ms,
37                         uint32_t min_playout_delay_ms);
38   virtual ~VcmPayloadSinkFactory();
39 
40   // PayloadSinkFactoryInterface
41   virtual PayloadSinkInterface* Create(RtpStreamInterface* stream);
42 
43   int DecodeAndProcessAll(bool decode_dual_frame);
44   bool ProcessAll();
45   bool DecodeAll();
46 
47  private:
48   class VcmPayloadSink;
49   friend class VcmPayloadSink;
50   typedef std::vector<VcmPayloadSink*> Sinks;
51 
52   void Remove(VcmPayloadSink* sink);
53 
54   std::string base_out_filename_;
55   Clock* clock_;
56   bool protection_enabled_;
57   VCMVideoProtection protection_method_;
58   int64_t rtt_ms_;
59   uint32_t render_delay_ms_;
60   uint32_t min_playout_delay_ms_;
61   rtc::scoped_ptr<NullEventFactory> null_event_factory_;
62   rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
63   Sinks sinks_;
64 
65   RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VcmPayloadSinkFactory);
66 };
67 }  // namespace rtpplayer
68 }  // namespace webrtc
69 
70 #endif  // WEBRTC_MODULES_VIDEO_CODING_TEST_VCM_PAYLOAD_SINK_FACTORY_H_
71