| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VIDEO_SENDER_VIDEO_SENDER_H_ | 5 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
| 6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 6 #define MEDIA_CAST_VIDEO_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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "media/cast/cast_config.h" | 15 #include "media/cast/cast_config.h" |
| 16 #include "media/cast/cast_environment.h" | 16 #include "media/cast/cast_environment.h" |
| 17 #include "media/cast/congestion_control/congestion_control.h" | 17 #include "media/cast/congestion_control/congestion_control.h" |
| 18 #include "media/cast/logging/logging_defines.h" | 18 #include "media/cast/logging/logging_defines.h" |
| 19 #include "media/cast/rtcp/rtcp.h" | 19 #include "media/cast/rtcp/rtcp.h" |
| 20 #include "media/cast/rtcp/sender_rtcp_event_subscriber.h" | 20 #include "media/cast/rtcp/sender_rtcp_event_subscriber.h" |
| 21 #include "media/filters/gpu_video_accelerator_factories.h" | |
| 22 #include "media/video/video_encode_accelerator.h" | |
| 23 | 21 |
| 24 namespace media { | 22 namespace media { |
| 25 class VideoFrame; | 23 class VideoFrame; |
| 26 | 24 |
| 27 namespace cast { | 25 namespace cast { |
| 28 class LocalRtcpVideoSenderFeedback; | 26 class LocalRtcpVideoSenderFeedback; |
| 29 class LocalVideoEncoderCallback; | 27 class LocalVideoEncoderCallback; |
| 30 class VideoEncoder; | 28 class VideoEncoder; |
| 31 | 29 |
| 32 namespace transport { | 30 namespace transport { |
| 33 class CastTransportSender; | 31 class CastTransportSender; |
| 34 } | 32 } |
| 35 | 33 |
| 36 // Not thread safe. Only called from the main cast thread. | 34 // Not thread safe. Only called from the main cast thread. |
| 37 // This class owns all objects related to sending video, objects that create RTP | 35 // This class owns all objects related to sending video, objects that create RTP |
| 38 // packets, congestion control, video encoder, parsing and sending of | 36 // packets, congestion control, video encoder, parsing and sending of |
| 39 // RTCP packets. | 37 // RTCP packets. |
| 40 // Additionally it posts a bunch of delayed tasks to the main thread for various | 38 // Additionally it posts a bunch of delayed tasks to the main thread for various |
| 41 // timeouts. | 39 // timeouts. |
| 42 class VideoSender : public base::NonThreadSafe, | 40 class VideoSender : public base::NonThreadSafe, |
| 43 public base::SupportsWeakPtr<VideoSender> { | 41 public base::SupportsWeakPtr<VideoSender> { |
| 44 public: | 42 public: |
| 45 VideoSender(scoped_refptr<CastEnvironment> cast_environment, | 43 VideoSender(scoped_refptr<CastEnvironment> cast_environment, |
| 46 const VideoSenderConfig& video_config, | 44 const VideoSenderConfig& video_config, |
| 47 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, | 45 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
| 46 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, |
| 48 const CastInitializationCallback& cast_initialization_cb, | 47 const CastInitializationCallback& cast_initialization_cb, |
| 49 transport::CastTransportSender* const transport_sender); | 48 transport::CastTransportSender* const transport_sender); |
| 50 | 49 |
| 51 virtual ~VideoSender(); | 50 virtual ~VideoSender(); |
| 52 | 51 |
| 53 // The video_frame must be valid until the closure callback is called. | 52 // The video_frame must be valid until the closure callback is called. |
| 54 // The closure callback is called from the video encoder thread as soon as | 53 // The closure callback is called from the video encoder thread as soon as |
| 55 // the encoder is done with the frame; it does not mean that the encoded frame | 54 // the encoder is done with the frame; it does not mean that the encoded frame |
| 56 // has been sent out. | 55 // has been sent out. |
| 57 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // NOTE: Weak pointers must be invalidated before all other member variables. | 146 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 148 base::WeakPtrFactory<VideoSender> weak_factory_; | 147 base::WeakPtrFactory<VideoSender> weak_factory_; |
| 149 | 148 |
| 150 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 149 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 } // namespace cast | 152 } // namespace cast |
| 154 } // namespace media | 153 } // namespace media |
| 155 | 154 |
| 156 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 155 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
| OLD | NEW |