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 fa85468c1fa55f7ed7b4aa3fa570bf2234cf59fa..51fa155ce098eaf184a80d767f51004724e40352 100644 |
--- a/media/cast/video_sender/video_encoder.h |
+++ b/media/cast/video_sender/video_encoder.h |
@@ -5,8 +5,8 @@ |
#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" |
@@ -18,7 +18,7 @@ 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> { |
+ public base::SupportsWeakPtr<VideoEncoder> { |
public: |
typedef base::Callback<void(scoped_ptr<EncodedVideoFrame>, |
const base::TimeTicks&)> FrameEncodedCallback; |
@@ -27,6 +27,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. |
@@ -40,8 +42,6 @@ class VideoEncoder : public VideoEncoderController, |
const base::Closure frame_release_callback); |
protected: |
- virtual ~VideoEncoder(); |
- |
struct CodecDynamicConfig { |
bool key_frame_requested; |
uint8 latest_frame_id_to_reference; |
@@ -64,8 +64,6 @@ class VideoEncoder : public VideoEncoderController, |
virtual int NumberOfSkippedFrames() const OVERRIDE; |
private: |
- friend class base::RefCountedThreadSafe<VideoEncoder>; |
- |
const VideoSenderConfig video_config_; |
scoped_refptr<CastEnvironment> cast_environment_; |
scoped_ptr<Vp8Encoder> vp8_encoder_; |
@@ -73,6 +71,8 @@ class VideoEncoder : public VideoEncoderController, |
bool skip_next_frame_; |
int skip_count_; |
+ base::WeakPtrFactory<VideoEncoder> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(VideoEncoder); |
}; |