| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ | 5 #ifndef MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ |
| 6 #define MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ | 6 #define MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Accessors for subclasses. | 45 // Accessors for subclasses. |
| 46 CastEnvironment* cast_environment() const { | 46 CastEnvironment* cast_environment() const { |
| 47 return cast_environment_.get(); | 47 return cast_environment_.get(); |
| 48 } | 48 } |
| 49 const VideoSenderConfig& video_config() const { | 49 const VideoSenderConfig& video_config() const { |
| 50 return video_config_; | 50 return video_config_; |
| 51 } | 51 } |
| 52 const gfx::Size& frame_size() const { | 52 const gfx::Size& frame_size() const { |
| 53 return frame_size_; | 53 return frame_size_; |
| 54 } | 54 } |
| 55 uint32 last_frame_id() const { | 55 uint32_t last_frame_id() const { return last_frame_id_; } |
| 56 return last_frame_id_; | |
| 57 } | |
| 58 | 56 |
| 59 // Returns a callback that calls OnEncoderStatusChange(). The callback is | 57 // Returns a callback that calls OnEncoderStatusChange(). The callback is |
| 60 // canceled by invalidating its bound weak pointer just before a replacement | 58 // canceled by invalidating its bound weak pointer just before a replacement |
| 61 // encoder is instantiated. In this scheme, OnEncoderStatusChange() can only | 59 // encoder is instantiated. In this scheme, OnEncoderStatusChange() can only |
| 62 // be called by the most-recent encoder. | 60 // be called by the most-recent encoder. |
| 63 StatusChangeCallback CreateEncoderStatusChangeCallback(); | 61 StatusChangeCallback CreateEncoderStatusChangeCallback(); |
| 64 | 62 |
| 65 // Overridden by subclasses to create a new encoder instance that handles | 63 // Overridden by subclasses to create a new encoder instance that handles |
| 66 // frames of the size specified by |frame_size()|. | 64 // frames of the size specified by |frame_size()|. |
| 67 virtual scoped_ptr<VideoEncoder> CreateEncoder() = 0; | 65 virtual scoped_ptr<VideoEncoder> CreateEncoder() = 0; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // The underlying platform video encoder and the frame size it expects. | 97 // The underlying platform video encoder and the frame size it expects. |
| 100 scoped_ptr<VideoEncoder> encoder_; | 98 scoped_ptr<VideoEncoder> encoder_; |
| 101 gfx::Size frame_size_; | 99 gfx::Size frame_size_; |
| 102 | 100 |
| 103 // The number of frames in |encoder_|'s pipeline. If this is set to | 101 // The number of frames in |encoder_|'s pipeline. If this is set to |
| 104 // kEncoderIsInitializing, |encoder_| is not yet ready to accept frames. | 102 // kEncoderIsInitializing, |encoder_| is not yet ready to accept frames. |
| 105 enum { kEncoderIsInitializing = -1 }; | 103 enum { kEncoderIsInitializing = -1 }; |
| 106 int frames_in_encoder_; | 104 int frames_in_encoder_; |
| 107 | 105 |
| 108 // The ID of the last frame that was emitted from |encoder_|. | 106 // The ID of the last frame that was emitted from |encoder_|. |
| 109 uint32 last_frame_id_; | 107 uint32_t last_frame_id_; |
| 110 | 108 |
| 111 // NOTE: Weak pointers must be invalidated before all other member variables. | 109 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 112 base::WeakPtrFactory<SizeAdaptableVideoEncoderBase> weak_factory_; | 110 base::WeakPtrFactory<SizeAdaptableVideoEncoderBase> weak_factory_; |
| 113 | 111 |
| 114 DISALLOW_COPY_AND_ASSIGN(SizeAdaptableVideoEncoderBase); | 112 DISALLOW_COPY_AND_ASSIGN(SizeAdaptableVideoEncoderBase); |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 } // namespace cast | 115 } // namespace cast |
| 118 } // namespace media | 116 } // namespace media |
| 119 | 117 |
| 120 #endif // MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ | 118 #endif // MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_ |
| OLD | NEW |