Chromium Code Reviews| 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_VIDEO_VIE_CHANNEL_H_ | 11 #ifndef WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
| 12 #define WEBRTC_VIDEO_VIE_CHANNEL_H_ | 12 #define WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
| 20 #include "webrtc/base/platform_thread.h" | 20 #include "webrtc/base/platform_thread.h" |
| 21 #include "webrtc/base/scoped_ref_ptr.h" | 21 #include "webrtc/base/scoped_ref_ptr.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" |
| 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | |
| 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
| 25 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 23 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
| 26 #include "webrtc/system_wrappers/include/tick_util.h" | 24 #include "webrtc/system_wrappers/include/tick_util.h" |
| 27 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
| 28 #include "webrtc/video/rtp_stream_receiver.h" | |
| 29 #include "webrtc/video/vie_sync_module.h" | 26 #include "webrtc/video/vie_sync_module.h" |
| 30 | 27 |
| 31 namespace webrtc { | 28 namespace webrtc { |
| 32 | 29 |
| 33 class CallStatsObserver; | 30 class CallStatsObserver; |
| 34 class ChannelStatsObserver; | 31 class ChannelStatsObserver; |
| 35 class Config; | 32 class Config; |
| 36 class EncodedImageCallback; | 33 class EncodedImageCallback; |
| 37 class I420FrameCallback; | 34 class I420FrameCallback; |
| 38 class IncomingVideoStream; | 35 class IncomingVideoStream; |
| 39 class PacedSender; | |
| 40 class PacketRouter; | |
| 41 class PayloadRouter; | |
| 42 class ReceiveStatisticsProxy; | 36 class ReceiveStatisticsProxy; |
| 43 class RtcpRttStats; | |
| 44 class ViERTPObserver; | |
| 45 class VideoRenderCallback; | 37 class VideoRenderCallback; |
| 46 class VoEVideoSync; | 38 class VoEVideoSync; |
| 47 | 39 |
| 48 namespace vcm { | 40 namespace vcm { |
| 49 class VideoReceiver; | 41 class VideoReceiver; |
| 50 } // namespace vcm | 42 } // namespace vcm |
| 51 | 43 |
| 52 enum StreamType { | 44 enum StreamType { |
| 53 kViEStreamTypeNormal = 0, // Normal media stream | 45 kViEStreamTypeNormal = 0, // Normal media stream |
| 54 kViEStreamTypeRtx = 1 // Retransmission media stream | 46 kViEStreamTypeRtx = 1 // Retransmission media stream |
| 55 }; | 47 }; |
| 56 | 48 |
| 57 class ViEChannel : public VCMFrameTypeCallback, | 49 class VideoStreamDecoder : public VCMReceiveCallback, |
| 58 public VCMReceiveCallback, | 50 public VCMReceiveStatisticsCallback, |
| 59 public VCMReceiveStatisticsCallback, | 51 public VCMDecoderTimingCallback { |
| 60 public VCMDecoderTimingCallback, | |
| 61 public VCMPacketRequestCallback { | |
| 62 public: | 52 public: |
| 63 friend class ChannelStatsObserver; | 53 friend class ChannelStatsObserver; |
| 64 | 54 |
| 65 ViEChannel(vcm::VideoReceiver* video_receiver, | 55 VideoStreamDecoder(vcm::VideoReceiver* video_receiver, |
| 66 RtpStreamReceiver* rtp_stream_receiver); | 56 VCMFrameTypeCallback* vcm_frame_type_callback, |
| 67 ~ViEChannel(); | 57 VCMPacketRequestCallback* vcm_packet_request_callback, |
| 68 | 58 bool enable_nack, |
| 69 int32_t Init(); | 59 ReceiveStatisticsProxy* receive_statistics_proxy); |
| 70 | 60 ~VideoStreamDecoder(); |
| 71 RtpRtcp* rtp_rtcp() const { return rtp_rtcp_; } | |
| 72 | |
| 73 void SetProtectionMode(bool enable_nack, | |
| 74 bool enable_fec, | |
| 75 int payload_type_red, | |
| 76 int payload_type_fec); | |
| 77 | |
| 78 RtpState GetRtpStateForSsrc(uint32_t ssrc) const; | |
| 79 | |
| 80 | 61 |
| 81 CallStatsObserver* GetStatsObserver(); | 62 CallStatsObserver* GetStatsObserver(); |
| 82 | 63 |
| 83 // Implements VCMReceiveCallback. | 64 // Implements VCMReceiveCallback. |
| 84 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT | 65 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT |
| 85 | |
| 86 // Implements VCMReceiveCallback. | |
| 87 virtual int32_t ReceivedDecodedReferenceFrame( | 66 virtual int32_t ReceivedDecodedReferenceFrame( |
| 88 const uint64_t picture_id); | 67 const uint64_t picture_id); |
| 89 | |
| 90 // Implements VCMReceiveCallback. | |
|
pbos-webrtc
2016/05/02 00:59:03
Add back, this still implements that?
mflodman
2016/05/02 19:01:27
That is already said above FrameToRender and doesn
| |
| 91 void OnIncomingPayloadType(int payload_type) override; | 68 void OnIncomingPayloadType(int payload_type) override; |
| 92 void OnDecoderImplementationName(const char* implementation_name) override; | 69 void OnDecoderImplementationName(const char* implementation_name) override; |
| 93 | 70 |
| 94 // Implements VCMReceiveStatisticsCallback. | 71 // Implements VCMReceiveStatisticsCallback. |
| 95 void OnReceiveRatesUpdated(uint32_t bit_rate, uint32_t frame_rate) override; | 72 void OnReceiveRatesUpdated(uint32_t bit_rate, uint32_t frame_rate) override; |
| 96 void OnDiscardedPacketsUpdated(int discarded_packets) override; | 73 void OnDiscardedPacketsUpdated(int discarded_packets) override; |
| 97 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; | 74 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; |
| 98 | 75 |
| 99 // Implements VCMDecoderTimingCallback. | 76 // Implements VCMDecoderTimingCallback. |
| 100 virtual void OnDecoderTiming(int decode_ms, | 77 virtual void OnDecoderTiming(int decode_ms, |
| 101 int max_decode_ms, | 78 int max_decode_ms, |
| 102 int current_delay_ms, | 79 int current_delay_ms, |
| 103 int target_delay_ms, | 80 int target_delay_ms, |
| 104 int jitter_buffer_ms, | 81 int jitter_buffer_ms, |
| 105 int min_playout_delay_ms, | 82 int min_playout_delay_ms, |
| 106 int render_delay_ms); | 83 int render_delay_ms); |
| 107 | 84 |
| 108 // Implements FrameTypeCallback. | |
| 109 virtual int32_t RequestKeyFrame(); | |
| 110 | |
| 111 // Implements FrameTypeCallback. | |
| 112 virtual int32_t SliceLossIndicationRequest( | |
| 113 const uint64_t picture_id); | |
| 114 | |
| 115 // Implements VideoPacketRequestCallback. | |
| 116 int32_t ResendPackets(const uint16_t* sequence_numbers, | |
| 117 uint16_t length) override; | |
| 118 | |
| 119 void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback); | 85 void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback); |
| 120 | 86 |
| 121 void RegisterRtcpPacketTypeCounterObserver( | |
| 122 RtcpPacketTypeCounterObserver* observer); | |
| 123 void RegisterReceiveStatisticsProxy( | 87 void RegisterReceiveStatisticsProxy( |
| 124 ReceiveStatisticsProxy* receive_statistics_proxy); | 88 ReceiveStatisticsProxy* receive_statistics_proxy); |
| 125 void SetIncomingVideoStream(IncomingVideoStream* incoming_video_stream); | 89 void SetIncomingVideoStream(IncomingVideoStream* incoming_video_stream); |
| 126 | 90 |
| 127 protected: | 91 protected: |
| 128 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); | 92 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); |
| 129 | 93 |
| 130 private: | 94 private: |
| 131 // Assumed to be protected. | 95 // Assumed to be protected. |
| 132 void StartDecodeThread(); | 96 void StartDecodeThread(); |
| 133 void StopDecodeThread(); | 97 void StopDecodeThread(); |
| 134 | 98 |
| 135 void ProcessNACKRequest(const bool enable); | |
| 136 // Compute NACK list parameters for the buffering mode. | |
| 137 int GetRequiredNackListSize(int target_delay_ms); | |
| 138 | |
| 139 // Used for all registered callbacks except rendering. | 99 // Used for all registered callbacks except rendering. |
| 140 rtc::CriticalSection crit_; | 100 rtc::CriticalSection crit_; |
| 141 | 101 |
| 142 vcm::VideoReceiver* const video_receiver_; | 102 vcm::VideoReceiver* const video_receiver_; |
| 143 RtpStreamReceiver* const rtp_stream_receiver_; | |
| 144 RtpRtcp* const rtp_rtcp_; | |
| 145 | 103 |
| 146 // Helper to report call statistics. | 104 // Helper to report call statistics. |
| 147 std::unique_ptr<ChannelStatsObserver> stats_observer_; | 105 std::unique_ptr<ChannelStatsObserver> stats_observer_; |
| 148 | 106 |
| 149 // Not owned. | 107 // Not owned. |
|
pbos-webrtc
2016/05/02 00:59:03
This comment bothers me, can you remove it? :)
mflodman
2016/05/02 19:01:27
Done.
| |
| 150 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); | 108 ReceiveStatisticsProxy* const receive_stats_callback_; |
| 151 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); | 109 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); |
| 152 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); | 110 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); |
| 153 | 111 |
| 154 int max_nack_reordering_threshold_; | |
| 155 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); | 112 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); |
| 156 | 113 |
| 157 int64_t last_rtt_ms_ GUARDED_BY(crit_); | 114 int64_t last_rtt_ms_ GUARDED_BY(crit_); |
| 158 }; | 115 }; |
| 159 | 116 |
| 160 } // namespace webrtc | 117 } // namespace webrtc |
| 161 | 118 |
| 162 #endif // WEBRTC_VIDEO_VIE_CHANNEL_H_ | 119 #endif // WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
| OLD | NEW |