| Index: media/cast/video_sender/video_encoder.h
|
| diff --git a/media/cast/video_sender/video_encoder.h b/media/cast/video_sender/video_encoder.h
|
| index 559dff16734fd4c9e72f1c2b8aa1a52d0e90ce73..f67bd1cf10548a886645459a964d78292fc22b79 100644
|
| --- a/media/cast/video_sender/video_encoder.h
|
| +++ b/media/cast/video_sender/video_encoder.h
|
| @@ -5,76 +5,51 @@
|
| #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_
|
| #define MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_
|
|
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| -#include "base/message_loop/message_loop.h"
|
| +#include "base/time/time.h"
|
| +#include "media/base/video_frame.h"
|
| #include "media/cast/cast_config.h"
|
| #include "media/cast/cast_environment.h"
|
| -#include "media/cast/video_sender/codecs/vp8/vp8_encoder.h"
|
| -
|
| -namespace media {
|
| -class VideoFrame;
|
| -}
|
|
|
| namespace media {
|
| namespace cast {
|
|
|
| -// This object is called external from the main cast thread and internally from
|
| -// the video encoder thread.
|
| -class VideoEncoder : public VideoEncoderController {
|
| +// All these functions are called from the main cast thread.
|
| +class VideoEncoder {
|
| public:
|
| typedef base::Callback<void(scoped_ptr<EncodedVideoFrame>,
|
| const base::TimeTicks&)> FrameEncodedCallback;
|
|
|
| - VideoEncoder(scoped_refptr<CastEnvironment> cast_environment,
|
| - const VideoSenderConfig& video_config,
|
| - uint8 max_unacked_frames);
|
| -
|
| - virtual ~VideoEncoder();
|
| -
|
| - // Called from the main cast thread. This function post the encode task to the
|
| - // video encoder thread;
|
| // The video_frame must be valid until the closure callback is called.
|
| // The closure callback is called from the video encoder thread as soon as
|
| // the encoder is done with the frame; it does not mean that the encoded frame
|
| // has been sent out.
|
| // Once the encoded frame is ready the frame_encoded_callback is called.
|
| - bool EncodeVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
|
| - const base::TimeTicks& capture_time,
|
| - const FrameEncodedCallback& frame_encoded_callback);
|
| -
|
| - protected:
|
| - struct CodecDynamicConfig {
|
| - bool key_frame_requested;
|
| - uint32 latest_frame_id_to_reference;
|
| - int bit_rate;
|
| - };
|
| -
|
| - // The actual encode, called from the video encoder thread.
|
| - void EncodeVideoFrameEncoderThread(
|
| + virtual bool EncodeVideoFrame(
|
| const scoped_refptr<media::VideoFrame>& video_frame,
|
| const base::TimeTicks& capture_time,
|
| - const CodecDynamicConfig& dynamic_config,
|
| - const FrameEncodedCallback& frame_encoded_callback);
|
| + const FrameEncodedCallback& frame_encoded_callback) = 0;
|
| +
|
| + // Inform the encoder about the new target bit rate.
|
| + virtual void SetBitRate(int new_bit_rate) = 0;
|
| +
|
| + // Inform the encoder to not encode the next frame.
|
| + // Note: this setting is sticky and should last until called with false.
|
| + virtual void SkipNextFrame(bool skip_next_frame) = 0;
|
|
|
| - // The following functions are called from the main cast thread.
|
| - virtual void SetBitRate(int new_bit_rate) OVERRIDE;
|
| - virtual void SkipNextFrame(bool skip_next_frame) OVERRIDE;
|
| - virtual void GenerateKeyFrame() OVERRIDE;
|
| - virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE;
|
| - virtual int NumberOfSkippedFrames() const OVERRIDE;
|
| + // Inform the encoder to encode the next frame as a key frame.
|
| + virtual void GenerateKeyFrame() = 0;
|
|
|
| - private:
|
| - friend class base::RefCountedThreadSafe<VideoEncoder>;
|
| + // Inform the encoder to only reference frames older or equal to frame_id;
|
| + virtual void LatestFrameIdToReference(uint32 frame_id) = 0;
|
|
|
| - const VideoSenderConfig video_config_;
|
| - scoped_refptr<CastEnvironment> cast_environment_;
|
| - scoped_ptr<Vp8Encoder> vp8_encoder_;
|
| - CodecDynamicConfig dynamic_config_;
|
| - bool skip_next_frame_;
|
| - int skip_count_;
|
| + // Query the codec about how many frames it has skipped due to slow ACK.
|
| + virtual int NumberOfSkippedFrames() const = 0;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(VideoEncoder);
|
| + virtual ~VideoEncoder() {}
|
| };
|
|
|
| } // namespace cast
|
|
|