summaryrefslogtreecommitdiff
path: root/media/cast/video_sender/video_encoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/cast/video_sender/video_encoder.h')
-rw-r--r--media/cast/video_sender/video_encoder.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/media/cast/video_sender/video_encoder.h b/media/cast/video_sender/video_encoder.h
index fa85468c1f..f8415f679a 100644
--- a/media/cast/video_sender/video_encoder.h
+++ b/media/cast/video_sender/video_encoder.h
@@ -5,20 +5,23 @@
#ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_
#define MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_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 "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,
- public base::RefCountedThreadSafe<VideoEncoder> {
+class VideoEncoder : public VideoEncoderController {
public:
typedef base::Callback<void(scoped_ptr<EncodedVideoFrame>,
const base::TimeTicks&)> FrameEncodedCallback;
@@ -27,6 +30,8 @@ class VideoEncoder : public VideoEncoderController,
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.
@@ -34,23 +39,21 @@ class VideoEncoder : public VideoEncoderController,
// 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 I420VideoFrame* video_frame,
+ bool EncodeVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
const base::TimeTicks& capture_time,
const FrameEncodedCallback& frame_encoded_callback,
const base::Closure frame_release_callback);
protected:
- virtual ~VideoEncoder();
-
struct CodecDynamicConfig {
bool key_frame_requested;
- uint8 latest_frame_id_to_reference;
+ uint32 latest_frame_id_to_reference;
int bit_rate;
};
// The actual encode, called from the video encoder thread.
void EncodeVideoFrameEncoderThread(
- const I420VideoFrame* video_frame,
+ const scoped_refptr<media::VideoFrame>& video_frame,
const base::TimeTicks& capture_time,
const CodecDynamicConfig& dynamic_config,
const FrameEncodedCallback& frame_encoded_callback,
@@ -60,7 +63,7 @@ class VideoEncoder : public VideoEncoderController,
virtual void SetBitRate(int new_bit_rate) OVERRIDE;
virtual void SkipNextFrame(bool skip_next_frame) OVERRIDE;
virtual void GenerateKeyFrame() OVERRIDE;
- virtual void LatestFrameIdToReference(uint8 frame_id) OVERRIDE;
+ virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE;
virtual int NumberOfSkippedFrames() const OVERRIDE;
private: