| 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 26 matching lines...) Expand all Loading... |
| 37 class IncomingVideoStream; | 37 class IncomingVideoStream; |
| 38 class PacedSender; | 38 class PacedSender; |
| 39 class PacketRouter; | 39 class PacketRouter; |
| 40 class PayloadRouter; | 40 class PayloadRouter; |
| 41 class ProcessThread; | 41 class ProcessThread; |
| 42 class ReceiveStatisticsProxy; | 42 class ReceiveStatisticsProxy; |
| 43 class ReportBlockStats; | 43 class ReportBlockStats; |
| 44 class RtcpRttStats; | 44 class RtcpRttStats; |
| 45 class ThreadWrapper; | 45 class ThreadWrapper; |
| 46 class ViEChannelProtectionCallback; | 46 class ViEChannelProtectionCallback; |
| 47 class ViEDecoderObserver; | |
| 48 class ViERTPObserver; | 47 class ViERTPObserver; |
| 49 class VideoCodingModule; | 48 class VideoCodingModule; |
| 50 class VideoDecoder; | 49 class VideoDecoder; |
| 51 class VideoRenderCallback; | 50 class VideoRenderCallback; |
| 52 class VoEVideoSync; | 51 class VoEVideoSync; |
| 53 | 52 |
| 54 enum StreamType { | 53 enum StreamType { |
| 55 kViEStreamTypeNormal = 0, // Normal media stream | 54 kViEStreamTypeNormal = 0, // Normal media stream |
| 56 kViEStreamTypeRtx = 1 // Retransmission media stream | 55 kViEStreamTypeRtx = 1 // Retransmission media stream |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 // This class declares an abstract interface for a user defined observer. It is | |
| 60 // up to the VideoEngine user to implement a derived class which implements the | |
| 61 // observer class. The observer is registered using RegisterDecoderObserver() | |
| 62 // and deregistered using DeregisterDecoderObserver(). | |
| 63 class ViEDecoderObserver { | |
| 64 public: | |
| 65 // This method is called when a new incoming stream is detected, normally | |
| 66 // triggered by a new incoming SSRC or payload type. | |
| 67 virtual void IncomingCodecChanged(const int video_channel, | |
| 68 const VideoCodec& video_codec) = 0; | |
| 69 | |
| 70 // This method is called once per second containing the frame rate and bit | |
| 71 // rate for the incoming stream | |
| 72 virtual void IncomingRate(const int video_channel, | |
| 73 const unsigned int framerate, | |
| 74 const unsigned int bitrate) = 0; | |
| 75 | |
| 76 // Called periodically with decoder timing information. All values are | |
| 77 // "current" snapshots unless decorated with a min_/max_ prefix. | |
| 78 virtual void DecoderTiming(int decode_ms, | |
| 79 int max_decode_ms, | |
| 80 int current_delay_ms, | |
| 81 int target_delay_ms, | |
| 82 int jitter_buffer_ms, | |
| 83 int min_playout_delay_ms, | |
| 84 int render_delay_ms) = 0; | |
| 85 | |
| 86 protected: | |
| 87 virtual ~ViEDecoderObserver() {} | |
| 88 }; | |
| 89 class ViEChannel : public VCMFrameTypeCallback, | 58 class ViEChannel : public VCMFrameTypeCallback, |
| 90 public VCMReceiveCallback, | 59 public VCMReceiveCallback, |
| 91 public VCMReceiveStatisticsCallback, | 60 public VCMReceiveStatisticsCallback, |
| 92 public VCMDecoderTimingCallback, | 61 public VCMDecoderTimingCallback, |
| 93 public VCMPacketRequestCallback, | 62 public VCMPacketRequestCallback, |
| 94 public RtpFeedback { | 63 public RtpFeedback { |
| 95 public: | 64 public: |
| 96 friend class ChannelStatsObserver; | 65 friend class ChannelStatsObserver; |
| 97 friend class ViEChannelProtectionCallback; | 66 friend class ViEChannelProtectionCallback; |
| 98 | 67 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 size_t max_rtp_streams, | 80 size_t max_rtp_streams, |
| 112 bool sender); | 81 bool sender); |
| 113 ~ViEChannel(); | 82 ~ViEChannel(); |
| 114 | 83 |
| 115 int32_t Init(); | 84 int32_t Init(); |
| 116 | 85 |
| 117 // Sets the encoder to use for the channel. |new_stream| indicates the encoder | 86 // Sets the encoder to use for the channel. |new_stream| indicates the encoder |
| 118 // type has changed and we should start a new RTP stream. | 87 // type has changed and we should start a new RTP stream. |
| 119 int32_t SetSendCodec(const VideoCodec& video_codec, bool new_stream = true); | 88 int32_t SetSendCodec(const VideoCodec& video_codec, bool new_stream = true); |
| 120 int32_t SetReceiveCodec(const VideoCodec& video_codec); | 89 int32_t SetReceiveCodec(const VideoCodec& video_codec); |
| 121 int32_t RegisterCodecObserver(ViEDecoderObserver* observer); | |
| 122 // Registers an external decoder. |buffered_rendering| means that the decoder | 90 // Registers an external decoder. |buffered_rendering| means that the decoder |
| 123 // will render frames after decoding according to the render timestamp | 91 // will render frames after decoding according to the render timestamp |
| 124 // provided by the video coding module. |render_delay| indicates the time | 92 // provided by the video coding module. |render_delay| indicates the time |
| 125 // needed to decode and render a frame. | 93 // needed to decode and render a frame. |
| 126 int32_t RegisterExternalDecoder(const uint8_t pl_type, | 94 int32_t RegisterExternalDecoder(const uint8_t pl_type, |
| 127 VideoDecoder* decoder, | 95 VideoDecoder* decoder, |
| 128 bool buffered_rendering, | 96 bool buffered_rendering, |
| 129 int32_t render_delay); | 97 int32_t render_delay); |
| 130 int32_t DeRegisterExternalDecoder(const uint8_t pl_type); | 98 int32_t DeRegisterExternalDecoder(const uint8_t pl_type); |
| 131 int32_t ReceiveCodecStatistics(uint32_t* num_key_frames, | 99 int32_t ReceiveCodecStatistics(uint32_t* num_key_frames, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 CallStatsObserver* GetStatsObserver(); | 232 CallStatsObserver* GetStatsObserver(); |
| 265 | 233 |
| 266 // Implements VCMReceiveCallback. | 234 // Implements VCMReceiveCallback. |
| 267 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT | 235 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT |
| 268 | 236 |
| 269 // Implements VCMReceiveCallback. | 237 // Implements VCMReceiveCallback. |
| 270 virtual int32_t ReceivedDecodedReferenceFrame( | 238 virtual int32_t ReceivedDecodedReferenceFrame( |
| 271 const uint64_t picture_id); | 239 const uint64_t picture_id); |
| 272 | 240 |
| 273 // Implements VCMReceiveCallback. | 241 // Implements VCMReceiveCallback. |
| 274 virtual void IncomingCodecChanged(const VideoCodec& codec); | 242 void OnIncomingPayloadType(int payload_type) override; |
| 275 | 243 |
| 276 // Implements VCMReceiveStatisticsCallback. | 244 // Implements VCMReceiveStatisticsCallback. |
| 277 void OnReceiveRatesUpdated(uint32_t bit_rate, uint32_t frame_rate) override; | 245 void OnReceiveRatesUpdated(uint32_t bit_rate, uint32_t frame_rate) override; |
| 278 void OnDiscardedPacketsUpdated(int discarded_packets) override; | 246 void OnDiscardedPacketsUpdated(int discarded_packets) override; |
| 279 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; | 247 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; |
| 280 | 248 |
| 281 // Implements VCMDecoderTimingCallback. | 249 // Implements VCMDecoderTimingCallback. |
| 282 virtual void OnDecoderTiming(int decode_ms, | 250 virtual void OnDecoderTiming(int decode_ms, |
| 283 int max_decode_ms, | 251 int max_decode_ms, |
| 284 int current_delay_ms, | 252 int current_delay_ms, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 rtc::scoped_ptr<ViEChannelProtectionCallback> vcm_protection_callback_; | 425 rtc::scoped_ptr<ViEChannelProtectionCallback> vcm_protection_callback_; |
| 458 | 426 |
| 459 VideoCodingModule* const vcm_; | 427 VideoCodingModule* const vcm_; |
| 460 ViEReceiver vie_receiver_; | 428 ViEReceiver vie_receiver_; |
| 461 ViESyncModule vie_sync_; | 429 ViESyncModule vie_sync_; |
| 462 | 430 |
| 463 // Helper to report call statistics. | 431 // Helper to report call statistics. |
| 464 rtc::scoped_ptr<ChannelStatsObserver> stats_observer_; | 432 rtc::scoped_ptr<ChannelStatsObserver> stats_observer_; |
| 465 | 433 |
| 466 // Not owned. | 434 // Not owned. |
| 467 VCMReceiveStatisticsCallback* vcm_receive_stats_callback_ | 435 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); |
| 468 GUARDED_BY(crit_); | |
| 469 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); | 436 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); |
| 470 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); | 437 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); |
| 471 ViEDecoderObserver* codec_observer_ GUARDED_BY(crit_); | |
| 472 RtcpIntraFrameObserver* const intra_frame_observer_; | 438 RtcpIntraFrameObserver* const intra_frame_observer_; |
| 473 RtcpRttStats* const rtt_stats_; | 439 RtcpRttStats* const rtt_stats_; |
| 474 PacedSender* const paced_sender_; | 440 PacedSender* const paced_sender_; |
| 475 PacketRouter* const packet_router_; | 441 PacketRouter* const packet_router_; |
| 476 | 442 |
| 477 const rtc::scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_; | 443 const rtc::scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
| 478 SendTimeObserver* const send_time_observer_; | 444 SendTimeObserver* const send_time_observer_; |
| 479 | 445 |
| 480 bool decoder_reset_ GUARDED_BY(crit_); | |
| 481 // Current receive codec used for codec change callback. | |
| 482 VideoCodec receive_codec_ GUARDED_BY(crit_); | |
| 483 rtc::scoped_ptr<ThreadWrapper> decode_thread_; | 446 rtc::scoped_ptr<ThreadWrapper> decode_thread_; |
| 484 | 447 |
| 485 int nack_history_size_sender_; | 448 int nack_history_size_sender_; |
| 486 int max_nack_reordering_threshold_; | 449 int max_nack_reordering_threshold_; |
| 487 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); | 450 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); |
| 488 | 451 |
| 489 const rtc::scoped_ptr<ReportBlockStats> report_block_stats_sender_; | 452 const rtc::scoped_ptr<ReportBlockStats> report_block_stats_sender_; |
| 490 | 453 |
| 491 int64_t time_of_first_rtt_ms_ GUARDED_BY(crit_); | 454 int64_t time_of_first_rtt_ms_ GUARDED_BY(crit_); |
| 492 int64_t rtt_sum_ms_ GUARDED_BY(crit_); | 455 int64_t rtt_sum_ms_ GUARDED_BY(crit_); |
| 493 size_t num_rtts_ GUARDED_BY(crit_); | 456 size_t num_rtts_ GUARDED_BY(crit_); |
| 494 | 457 |
| 495 // RtpRtcp modules, declared last as they use other members on construction. | 458 // RtpRtcp modules, declared last as they use other members on construction. |
| 496 const std::vector<RtpRtcp*> rtp_rtcp_modules_; | 459 const std::vector<RtpRtcp*> rtp_rtcp_modules_; |
| 497 size_t num_active_rtp_rtcp_modules_ GUARDED_BY(crit_); | 460 size_t num_active_rtp_rtcp_modules_ GUARDED_BY(crit_); |
| 498 }; | 461 }; |
| 499 | 462 |
| 500 } // namespace webrtc | 463 } // namespace webrtc |
| 501 | 464 |
| 502 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_ | 465 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_ |
| OLD | NEW |