| Index: webrtc/video/vie_encoder.h
|
| diff --git a/webrtc/video/vie_encoder.h b/webrtc/video/vie_encoder.h
|
| index 212962348ad7a110c24a3060437fe7c320e1531e..c7246a7c792a91db9255bd4b7865d0920857c905 100644
|
| --- a/webrtc/video/vie_encoder.h
|
| +++ b/webrtc/video/vie_encoder.h
|
| @@ -49,6 +49,23 @@ class VideoEncoder;
|
| // the encoded bit stream.
|
| // 5. Call Start.
|
| // 6. For each available raw video frame call EncodeVideoFrame.
|
| +
|
| +class VideoEncoderSink : public EncodedImageCallback {
|
| + public:
|
| + static const int TimeOutMs = 2000;
|
| +
|
| + // Triggered if the encoder has not produced a frame for |TimeOutMs|.
|
| + // The effect of this call is that no padding will be sent for this stream and
|
| + // thus, this method should thus not be called if padding is needed.
|
| + // Note that this method should not be called if the encoder is
|
| + // not supposed to produce data. Ie, the current allowed bitrate is zero.
|
| + // May be called on an arbitrary thread.
|
| + virtual void OnEncoderActivityChanged(bool running) = 0;
|
| +
|
| + protected:
|
| + virtual ~VideoEncoderSink() {}
|
| +};
|
| +
|
| class ViEEncoder : public VideoEncoderRateObserver,
|
| public EncodedImageCallback,
|
| public VCMSendStatisticsCallback {
|
| @@ -59,8 +76,7 @@ class ViEEncoder : public VideoEncoderRateObserver,
|
| ProcessThread* module_process_thread,
|
| SendStatisticsProxy* stats_proxy,
|
| OveruseFrameDetector* overuse_detector,
|
| - EncodedImageCallback* sink);
|
| -
|
| + VideoEncoderSink* sink);
|
| ~ViEEncoder();
|
|
|
| vcm::VideoSender* video_sender();
|
| @@ -78,12 +94,19 @@ class ViEEncoder : public VideoEncoderRateObserver,
|
| bool internal_source);
|
| int32_t DeRegisterExternalEncoder(uint8_t pl_type);
|
| void SetEncoder(const VideoCodec& video_codec,
|
| - int min_transmit_bitrate_bps,
|
| size_t max_data_payload_length);
|
|
|
| void EncodeVideoFrame(const VideoFrame& video_frame);
|
| void SendKeyFrame();
|
|
|
| + // Checks to see if the encoder has produced anything during the last
|
| + // VideoEncoderSink::TimeOutMs period and if the state has changed, calls
|
| + // VideoEncoderSink::OnEncoderActivityChanged.
|
| + // Must be called periodically.
|
| + // TODO(perkj): CheckForActivity should be replaced with an internal timer
|
| + // once ViEncoder owns the encoder thread.
|
| + void CheckForActivity();
|
| +
|
| uint32_t LastObservedBitrateBps() const;
|
| // Loss protection. Must be called before SetEncoder() to have max packet size
|
| // updated according to protection.
|
| @@ -108,8 +131,6 @@ class ViEEncoder : public VideoEncoderRateObserver,
|
| virtual void OnReceivedSLI(uint8_t picture_id);
|
| virtual void OnReceivedRPSI(uint64_t picture_id);
|
|
|
| - int GetPaddingNeededBps() const;
|
| -
|
| void OnBitrateUpdated(uint32_t bitrate_bps,
|
| uint8_t fraction_lost,
|
| int64_t round_trip_time_ms);
|
| @@ -120,7 +141,7 @@ class ViEEncoder : public VideoEncoderRateObserver,
|
| void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_);
|
|
|
| const uint32_t number_of_cores_;
|
| - EncodedImageCallback* const sink_;
|
| + VideoEncoderSink* const sink_;
|
|
|
| const std::unique_ptr<VideoProcessing> vp_;
|
| vcm::VideoSender video_sender_;
|
| @@ -135,10 +156,10 @@ class ViEEncoder : public VideoEncoderRateObserver,
|
| // padding.
|
| int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_);
|
| VideoCodec encoder_config_ GUARDED_BY(data_cs_);
|
| - int min_transmit_bitrate_bps_ GUARDED_BY(data_cs_);
|
| uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_);
|
| bool encoder_paused_ GUARDED_BY(data_cs_);
|
| bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_);
|
| + bool reported_timeout_ GUARDED_BY(data_cs_);
|
|
|
| ProcessThread* module_process_thread_;
|
|
|
|
|