OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |
| 13 |
| 14 #include "webrtc/base/basictypes.h" |
| 15 #include "webrtc/modules/include/module_common_types.h" |
| 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 17 |
| 18 namespace webrtc { |
| 19 |
| 20 // This class tracks the application requests to limit minimum and maximum |
| 21 // playout delay and makes a decision on whether the current RTP frame |
| 22 // should include the playout out delay extension header. |
| 23 // |
| 24 // Playout delay can be defined in terms of capture and render time as follows: |
| 25 // |
| 26 // Render time = Capture time in receiver time + playout delay |
| 27 // |
| 28 // The application specifies a minimum and maximum limit for the playout delay |
| 29 // which are both communicated to the receiver and the receiver can adapt |
| 30 // the playout delay within this range based on observed network jitter. |
| 31 class PlayoutDelayOracle { |
| 32 public: |
| 33 PlayoutDelayOracle(); |
| 34 ~PlayoutDelayOracle(); |
| 35 |
| 36 // Returns true if the current frame should include the playout delay |
| 37 // extension |
| 38 bool send_playout_delay() const { return send_playout_delay_; } |
| 39 |
| 40 // Returns current minimum playout delay in milliseconds. |
| 41 int min_playout_delay_ms() const { return min_playout_delay_ms_; } |
| 42 |
| 43 // Returns current maximum playout delay in milliseconds. |
| 44 int max_playout_delay_ms() const { return max_playout_delay_ms_; } |
| 45 |
| 46 // Updates the application requested playout delay, current ssrc |
| 47 // and the current sequence number. |
| 48 void UpdateRequest(uint32_t ssrc, |
| 49 PlayoutDelay playout_delay, |
| 50 uint16_t seq_num); |
| 51 |
| 52 void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks); |
| 53 |
| 54 private: |
| 55 // The current highest sequence number on which playout delay has been sent. |
| 56 int64_t high_sequence_number_; |
| 57 // Indicates whether the playout delay should go on the next frame. |
| 58 bool send_playout_delay_; |
| 59 // Min playout delay value on the next frame if |send_playout_delay_| is set. |
| 60 int min_playout_delay_ms_; |
| 61 // Max playout delay value on the next frame if |send_playout_delay_| is set. |
| 62 int max_playout_delay_ms_; |
| 63 // Sender ssrc. |
| 64 uint32_t ssrc_; |
| 65 // Sequence number unwrapper. |
| 66 SequenceNumberUnwrapper unwrapper_; |
| 67 |
| 68 RTC_DISALLOW_COPY_AND_ASSIGN(PlayoutDelayOracle); |
| 69 }; |
| 70 |
| 71 } // namespace webrtc |
| 72 |
| 73 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |
OLD | NEW |