| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_SENDER_H_ | 5 #ifndef MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
| 6 #define MEDIA_CAST_SENDER_VIDEO_SENDER_H_ | 6 #define MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public base::SupportsWeakPtr<VideoSender> { | 38 public base::SupportsWeakPtr<VideoSender> { |
| 39 public: | 39 public: |
| 40 VideoSender(scoped_refptr<CastEnvironment> cast_environment, | 40 VideoSender(scoped_refptr<CastEnvironment> cast_environment, |
| 41 const VideoSenderConfig& video_config, | 41 const VideoSenderConfig& video_config, |
| 42 const CastInitializationCallback& initialization_cb, | 42 const CastInitializationCallback& initialization_cb, |
| 43 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 43 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
| 44 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, | 44 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, |
| 45 CastTransportSender* const transport_sender, | 45 CastTransportSender* const transport_sender, |
| 46 const PlayoutDelayChangeCB& playout_delay_change_cb); | 46 const PlayoutDelayChangeCB& playout_delay_change_cb); |
| 47 | 47 |
| 48 virtual ~VideoSender(); | 48 ~VideoSender() override; |
| 49 | 49 |
| 50 // Note: It is not guaranteed that |video_frame| will actually be encoded and | 50 // Note: It is not guaranteed that |video_frame| will actually be encoded and |
| 51 // sent, if VideoSender detects too many frames in flight. Therefore, clients | 51 // sent, if VideoSender detects too many frames in flight. Therefore, clients |
| 52 // should be careful about the rate at which this method is called. | 52 // should be careful about the rate at which this method is called. |
| 53 // | 53 // |
| 54 // Note: It is invalid to call this method if InitializationResult() returns | 54 // Note: It is invalid to call this method if InitializationResult() returns |
| 55 // anything but STATUS_VIDEO_INITIALIZED. | 55 // anything but STATUS_VIDEO_INITIALIZED. |
| 56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 57 const base::TimeTicks& reference_time); | 57 const base::TimeTicks& reference_time); |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 virtual int GetNumberOfFramesInEncoder() const override; | 60 int GetNumberOfFramesInEncoder() const override; |
| 61 virtual base::TimeDelta GetInFlightMediaDuration() const override; | 61 base::TimeDelta GetInFlightMediaDuration() const override; |
| 62 virtual void OnAck(uint32 frame_id) override; | 62 void OnAck(uint32 frame_id) override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // Called when the encoder is initialized or has failed to initialize. | 65 // Called when the encoder is initialized or has failed to initialize. |
| 66 void OnEncoderInitialized( | 66 void OnEncoderInitialized( |
| 67 const CastInitializationCallback& initialization_cb, | 67 const CastInitializationCallback& initialization_cb, |
| 68 CastInitializationStatus status); | 68 CastInitializationStatus status); |
| 69 | 69 |
| 70 // Called by the |video_encoder_| with the next EncodedFrame to send. | 70 // Called by the |video_encoder_| with the next EncodedFrame to send. |
| 71 void OnEncodedVideoFrame(int encoder_bitrate, | 71 void OnEncodedVideoFrame(int encoder_bitrate, |
| 72 scoped_ptr<EncodedFrame> encoded_frame); | 72 scoped_ptr<EncodedFrame> encoded_frame); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 // NOTE: Weak pointers must be invalidated before all other member variables. | 95 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 96 base::WeakPtrFactory<VideoSender> weak_factory_; | 96 base::WeakPtrFactory<VideoSender> weak_factory_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 98 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace cast | 101 } // namespace cast |
| 102 } // namespace media | 102 } // namespace media |
| 103 | 103 |
| 104 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ | 104 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
| OLD | NEW |