| Index: media/cast/sender/h264_vt_encoder.h
|
| diff --git a/media/cast/sender/h264_vt_encoder.h b/media/cast/sender/h264_vt_encoder.h
|
| index 756571c0c10bb804ae46e26556bfeb2c248ea4f0..4df932069521771ab5e3e2cd7f22c7009802e2ea 100644
|
| --- a/media/cast/sender/h264_vt_encoder.h
|
| +++ b/media/cast/sender/h264_vt_encoder.h
|
| @@ -6,6 +6,7 @@
|
| #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
|
|
|
| #include "base/mac/scoped_cftyperef.h"
|
| +#include "base/power_monitor/power_observer.h"
|
| #include "base/threading/thread_checker.h"
|
| #include "media/base/mac/videotoolbox_glue.h"
|
| #include "media/cast/sender/size_adaptable_video_encoder_base.h"
|
| @@ -17,8 +18,10 @@ namespace cast {
|
| // VideoToolbox implementation of the media::cast::VideoEncoder interface.
|
| // VideoToolbox makes no guarantees that it is thread safe, so this object is
|
| // pinned to the thread on which it is constructed. Supports changing frame
|
| -// sizes directly.
|
| -class H264VideoToolboxEncoder : public VideoEncoder {
|
| +// sizes directly. Implements the base::PowerObserver interface to reset the
|
| +// compression session when the host process is suspended.
|
| +class H264VideoToolboxEncoder : public VideoEncoder,
|
| + public base::PowerObserver {
|
| typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef;
|
| typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef;
|
| typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags;
|
| @@ -45,6 +48,10 @@ class H264VideoToolboxEncoder : public VideoEncoder {
|
| scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory() override;
|
| void EmitFrames() override;
|
|
|
| + // base::PowerObserver
|
| + void OnSuspend() override;
|
| + void OnResume() override;
|
| +
|
| private:
|
| // VideoFrameFactory tied to the VideoToolbox encoder.
|
| class VideoFrameFactoryImpl;
|
| @@ -111,6 +118,9 @@ class H264VideoToolboxEncoder : public VideoEncoder {
|
| // Force next frame to be a keyframe.
|
| bool encode_next_frame_as_keyframe_;
|
|
|
| + // Power suspension state.
|
| + bool power_suspended_;
|
| +
|
| // NOTE: Weak pointers must be invalidated before all other member variables.
|
| base::WeakPtrFactory<H264VideoToolboxEncoder> weak_factory_;
|
|
|
|
|