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 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ |
13 | 13 |
14 #include "webrtc/base/criticalsection.h" | 14 #include "webrtc/base/criticalsection.h" |
15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
17 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
18 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
| 22 struct CodecInst; |
| 23 |
22 class TelephoneEventHandler; | 24 class TelephoneEventHandler; |
23 | 25 |
24 // This strategy deals with media-specific RTP packet processing. | 26 // This strategy deals with media-specific RTP packet processing. |
25 // This class is not thread-safe and must be protected by its caller. | 27 // This class is not thread-safe and must be protected by its caller. |
26 class RTPReceiverStrategy { | 28 class RTPReceiverStrategy { |
27 public: | 29 public: |
28 static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback); | 30 static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback); |
29 static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback); | 31 static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback); |
30 | 32 |
31 virtual ~RTPReceiverStrategy() {} | 33 virtual ~RTPReceiverStrategy() {} |
(...skipping 15 matching lines...) Expand all Loading... |
47 virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0; | 49 virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0; |
48 | 50 |
49 // Computes the current dead-or-alive state. | 51 // Computes the current dead-or-alive state. |
50 virtual RTPAliveType ProcessDeadOrAlive( | 52 virtual RTPAliveType ProcessDeadOrAlive( |
51 uint16_t last_payload_length) const = 0; | 53 uint16_t last_payload_length) const = 0; |
52 | 54 |
53 // Returns true if we should report CSRC changes for this payload type. | 55 // Returns true if we should report CSRC changes for this payload type. |
54 // TODO(phoglund): should move out of here along with other payload stuff. | 56 // TODO(phoglund): should move out of here along with other payload stuff. |
55 virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const = 0; | 57 virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const = 0; |
56 | 58 |
57 // Notifies the strategy that we have created a new non-RED payload type in | 59 // Notifies the strategy that we have created a new non-RED audio payload type |
58 // the payload registry. | 60 // in the payload registry. |
59 virtual int32_t OnNewPayloadTypeCreated( | 61 virtual int32_t OnNewPayloadTypeCreated(const CodecInst& audio_codec) = 0; |
60 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | |
61 int8_t payloadType, | |
62 uint32_t frequency) = 0; | |
63 | 62 |
64 // Invokes the OnInitializeDecoder callback in a media-specific way. | 63 // Invokes the OnInitializeDecoder callback in a media-specific way. |
65 virtual int32_t InvokeOnInitializeDecoder( | 64 virtual int32_t InvokeOnInitializeDecoder( |
66 RtpFeedback* callback, | 65 RtpFeedback* callback, |
67 int8_t payload_type, | 66 int8_t payload_type, |
68 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 67 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
69 const PayloadUnion& specific_payload) const = 0; | 68 const PayloadUnion& specific_payload) const = 0; |
70 | 69 |
71 // Checks if the payload type has changed, and returns whether we should | 70 // Checks if the payload type has changed, and returns whether we should |
72 // reset statistics and/or discard this packet. | 71 // reset statistics and/or discard this packet. |
(...skipping 18 matching lines...) Expand all Loading... |
91 // packet. | 90 // packet. |
92 explicit RTPReceiverStrategy(RtpData* data_callback); | 91 explicit RTPReceiverStrategy(RtpData* data_callback); |
93 | 92 |
94 rtc::CriticalSection crit_sect_; | 93 rtc::CriticalSection crit_sect_; |
95 PayloadUnion last_payload_; | 94 PayloadUnion last_payload_; |
96 RtpData* data_callback_; | 95 RtpData* data_callback_; |
97 }; | 96 }; |
98 } // namespace webrtc | 97 } // namespace webrtc |
99 | 98 |
100 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ | 99 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_STRATEGY_H_ |
OLD | NEW |