Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: media/cast/video_sender/video_sender.h

Issue 116623002: Cast: Adding support for GPU accelerated encode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed dependency on content Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/rtcp/rtcp.h" 18 #include "media/cast/rtcp/rtcp.h"
19 #include "media/cast/rtp_sender/rtp_sender.h" 19 #include "media/cast/rtp_sender/rtp_sender.h"
20 #include "media/filters/gpu_video_accelerator_factories.h"
21 #include "media/video/video_encode_accelerator.h"
20 22
21 namespace crypto { 23 namespace crypto {
22 class Encryptor; 24 class Encryptor;
23 } 25 }
24 26
25 namespace media { 27 namespace media {
26 class VideoFrame; 28 class VideoFrame;
27 } 29 }
28 30
29 namespace media { 31 namespace media {
30 namespace cast { 32 namespace cast {
31 33
32 class VideoEncoder; 34 class VideoEncoder;
33 class LocalRtcpVideoSenderFeedback; 35 class LocalRtcpVideoSenderFeedback;
34 class LocalRtpVideoSenderStatistics; 36 class LocalRtpVideoSenderStatistics;
35 class LocalVideoEncoderCallback; 37 class LocalVideoEncoderCallback;
36 class PacedPacketSender; 38 class PacedPacketSender;
37 39
38 // Not thread safe. Only called from the main cast thread. 40 // Not thread safe. Only called from the main cast thread.
39 // This class owns all objects related to sending video, objects that create RTP 41 // This class owns all objects related to sending video, objects that create RTP
40 // packets, congestion control, video encoder, parsing and sending of 42 // packets, congestion control, video encoder, parsing and sending of
41 // RTCP packets. 43 // RTCP packets.
42 // Additionally it posts a bunch of delayed tasks to the main thread for various 44 // Additionally it posts a bunch of delayed tasks to the main thread for various
43 // timeouts. 45 // timeouts.
44 class VideoSender : public base::NonThreadSafe, 46 class VideoSender : public base::NonThreadSafe,
45 public base::SupportsWeakPtr<VideoSender> { 47 public base::SupportsWeakPtr<VideoSender> {
46 public: 48 public:
47 VideoSender(scoped_refptr<CastEnvironment> cast_environment, 49 VideoSender(
48 const VideoSenderConfig& video_config, 50 scoped_refptr<CastEnvironment> cast_environment,
49 VideoEncoderController* const video_encoder_controller, 51 const VideoSenderConfig& video_config,
50 PacedPacketSender* const paced_packet_sender); 52 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories,
53 PacedPacketSender* const paced_packet_sender);
51 54
52 virtual ~VideoSender(); 55 virtual ~VideoSender();
53 56
54 // The video_frame must be valid until the closure callback is called. 57 // The video_frame must be valid until the closure callback is called.
55 // The closure callback is called from the video encoder thread as soon as 58 // The closure callback is called from the video encoder thread as soon as
56 // the encoder is done with the frame; it does not mean that the encoded frame 59 // the encoder is done with the frame; it does not mean that the encoded frame
57 // has been sent out. 60 // has been sent out.
58 void InsertRawVideoFrame( 61 void InsertRawVideoFrame(
59 const scoped_refptr<media::VideoFrame>& video_frame, 62 const scoped_refptr<media::VideoFrame>& video_frame,
60 const base::TimeTicks& capture_time); 63 const base::TimeTicks& capture_time);
61 64
62 // The video_frame must be valid until the closure callback is called.
63 // The closure callback is called from the main thread as soon as
64 // the cast sender is done with the frame; it does not mean that the encoded
65 // frame has been sent out.
66 void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame,
67 const base::TimeTicks& capture_time,
68 const base::Closure callback);
69
70 // Only called from the main cast thread. 65 // Only called from the main cast thread.
71 void IncomingRtcpPacket(const uint8* packet, size_t length, 66 void IncomingRtcpPacket(const uint8* packet, size_t length,
72 const base::Closure callback); 67 const base::Closure callback);
73 68
74 protected: 69 protected:
75 // Protected for testability. 70 // Protected for testability.
76 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); 71 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback);
77 72
78 private: 73 private:
79 friend class LocalRtcpVideoSenderFeedback; 74 friend class LocalRtcpVideoSenderFeedback;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 111
117 const base::TimeDelta rtp_max_delay_; 112 const base::TimeDelta rtp_max_delay_;
118 const int max_frame_rate_; 113 const int max_frame_rate_;
119 114
120 scoped_refptr<CastEnvironment> cast_environment_; 115 scoped_refptr<CastEnvironment> cast_environment_;
121 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; 116 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_;
122 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; 117 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_;
123 scoped_ptr<VideoEncoder> video_encoder_; 118 scoped_ptr<VideoEncoder> video_encoder_;
124 scoped_ptr<Rtcp> rtcp_; 119 scoped_ptr<Rtcp> rtcp_;
125 scoped_ptr<RtpSender> rtp_sender_; 120 scoped_ptr<RtpSender> rtp_sender_;
126 VideoEncoderController* video_encoder_controller_;
127 uint8 max_unacked_frames_; 121 uint8 max_unacked_frames_;
128 scoped_ptr<crypto::Encryptor> encryptor_; 122 scoped_ptr<crypto::Encryptor> encryptor_;
129 std::string iv_mask_; 123 std::string iv_mask_;
130 int last_acked_frame_id_; 124 int last_acked_frame_id_;
131 int last_sent_frame_id_; 125 int last_sent_frame_id_;
132 int duplicate_ack_; 126 int duplicate_ack_;
133 base::TimeTicks last_send_time_; 127 base::TimeTicks last_send_time_;
134 base::TimeTicks last_checked_skip_count_time_; 128 base::TimeTicks last_checked_skip_count_time_;
135 int last_skip_count_; 129 int last_skip_count_;
136 CongestionControl congestion_control_; 130 CongestionControl congestion_control_;
137 131
138 bool initialized_; 132 bool initialized_;
139 base::WeakPtrFactory<VideoSender> weak_factory_; 133 base::WeakPtrFactory<VideoSender> weak_factory_;
140 134
141 DISALLOW_COPY_AND_ASSIGN(VideoSender); 135 DISALLOW_COPY_AND_ASSIGN(VideoSender);
142 }; 136 };
143 137
144 } // namespace cast 138 } // namespace cast
145 } // namespace media 139 } // namespace media
146 140
147 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ 141 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_
148 142
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698