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

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

Issue 562653004: Cast: First stab at implementing adaptive latency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change rtt window to ~10 minutes Created 6 years, 3 months 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 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"
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/sender/congestion_control.h" 16 #include "media/cast/sender/congestion_control.h"
17 #include "media/cast/sender/frame_sender.h" 17 #include "media/cast/sender/frame_sender.h"
18 18
19 namespace media { 19 namespace media {
20 20
21 class VideoFrame; 21 class VideoFrame;
22 22
23 namespace cast { 23 namespace cast {
24 24
25 class CastTransportSender; 25 class CastTransportSender;
26 class VideoEncoder; 26 class VideoEncoder;
27 27
28 typedef base::Callback<void(base::TimeDelta)> PlayoutDelayChangeCB;
29
28 // Not thread safe. Only called from the main cast thread. 30 // Not thread safe. Only called from the main cast thread.
29 // This class owns all objects related to sending video, objects that create RTP 31 // This class owns all objects related to sending video, objects that create RTP
30 // packets, congestion control, video encoder, parsing and sending of 32 // packets, congestion control, video encoder, parsing and sending of
31 // RTCP packets. 33 // RTCP packets.
32 // Additionally it posts a bunch of delayed tasks to the main thread for various 34 // Additionally it posts a bunch of delayed tasks to the main thread for various
33 // timeouts. 35 // timeouts.
34 class VideoSender : public FrameSender, 36 class VideoSender : public FrameSender,
35 public base::NonThreadSafe, 37 public base::NonThreadSafe,
36 public base::SupportsWeakPtr<VideoSender> { 38 public base::SupportsWeakPtr<VideoSender> {
37 public: 39 public:
38 VideoSender(scoped_refptr<CastEnvironment> cast_environment, 40 VideoSender(scoped_refptr<CastEnvironment> cast_environment,
39 const VideoSenderConfig& video_config, 41 const VideoSenderConfig& video_config,
40 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 42 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
41 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, 43 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
42 CastTransportSender* const transport_sender); 44 CastTransportSender* const transport_sender,
45 const PlayoutDelayChangeCB& playout_delay_change_cb);
43 46
44 virtual ~VideoSender(); 47 virtual ~VideoSender();
45 48
46 CastInitializationStatus InitializationResult() const { 49 CastInitializationStatus InitializationResult() const {
47 return cast_initialization_status_; 50 return cast_initialization_status_;
48 } 51 }
49 52
50 // Note: It is not guaranteed that |video_frame| will actually be encoded and 53 // 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 54 // sent, if VideoSender detects too many frames in flight. Therefore, clients
52 // should be careful about the rate at which this method is called. 55 // should be careful about the rate at which this method is called.
(...skipping 17 matching lines...) Expand all
70 // a hardware-based encoder. 73 // a hardware-based encoder.
71 scoped_ptr<VideoEncoder> video_encoder_; 74 scoped_ptr<VideoEncoder> video_encoder_;
72 75
73 // The number of frames queued for encoding, but not yet sent. 76 // The number of frames queued for encoding, but not yet sent.
74 int frames_in_encoder_; 77 int frames_in_encoder_;
75 78
76 // Remember what we set the bitrate to before, no need to set it again if 79 // Remember what we set the bitrate to before, no need to set it again if
77 // we get the same value. 80 // we get the same value.
78 uint32 last_bitrate_; 81 uint32 last_bitrate_;
79 82
83 PlayoutDelayChangeCB playout_delay_change_cb_;
84
80 // NOTE: Weak pointers must be invalidated before all other member variables. 85 // NOTE: Weak pointers must be invalidated before all other member variables.
81 base::WeakPtrFactory<VideoSender> weak_factory_; 86 base::WeakPtrFactory<VideoSender> weak_factory_;
82 87
83 DISALLOW_COPY_AND_ASSIGN(VideoSender); 88 DISALLOW_COPY_AND_ASSIGN(VideoSender);
84 }; 89 };
85 90
86 } // namespace cast 91 } // namespace cast
87 } // namespace media 92 } // namespace media
88 93
89 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ 94 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698