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 // This is the main interface for the cast sender. | 5 // This is the main interface for the cast sender. |
6 // | 6 // |
7 // The AudioFrameInput, VideoFrameInput and PacketReciever interfaces should | 7 // The AudioFrameInput, VideoFrameInput and PacketReciever interfaces should |
8 // be accessed from the main thread. | 8 // be accessed from the main thread. |
9 | 9 |
10 #ifndef MEDIA_CAST_CAST_SENDER_H_ | 10 #ifndef MEDIA_CAST_CAST_SENDER_H_ |
11 #define MEDIA_CAST_CAST_SENDER_H_ | 11 #define MEDIA_CAST_CAST_SENDER_H_ |
12 | 12 |
| 13 #include <memory> |
| 14 |
13 #include "base/callback.h" | 15 #include "base/callback.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/time/tick_clock.h" | 17 #include "base/time/tick_clock.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "media/base/audio_bus.h" | 19 #include "media/base/audio_bus.h" |
19 #include "media/cast/cast_config.h" | 20 #include "media/cast/cast_config.h" |
20 #include "media/cast/cast_environment.h" | 21 #include "media/cast/cast_environment.h" |
21 #include "media/cast/constants.h" | 22 #include "media/cast/constants.h" |
22 #include "media/cast/net/cast_transport.h" | 23 #include "media/cast/net/cast_transport.h" |
23 | 24 |
24 namespace gfx { | 25 namespace gfx { |
25 class Size; | 26 class Size; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual ~VideoFrameInput() {} | 62 virtual ~VideoFrameInput() {} |
62 | 63 |
63 private: | 64 private: |
64 friend class base::RefCountedThreadSafe<VideoFrameInput>; | 65 friend class base::RefCountedThreadSafe<VideoFrameInput>; |
65 }; | 66 }; |
66 | 67 |
67 class AudioFrameInput : public base::RefCountedThreadSafe<AudioFrameInput> { | 68 class AudioFrameInput : public base::RefCountedThreadSafe<AudioFrameInput> { |
68 public: | 69 public: |
69 // Insert audio frames into Cast sender. Frames will be encoded, packetized | 70 // Insert audio frames into Cast sender. Frames will be encoded, packetized |
70 // and sent to the network. | 71 // and sent to the network. |
71 virtual void InsertAudio(scoped_ptr<AudioBus> audio_bus, | 72 virtual void InsertAudio(std::unique_ptr<AudioBus> audio_bus, |
72 const base::TimeTicks& recorded_time) = 0; | 73 const base::TimeTicks& recorded_time) = 0; |
73 | 74 |
74 protected: | 75 protected: |
75 virtual ~AudioFrameInput() {} | 76 virtual ~AudioFrameInput() {} |
76 | 77 |
77 private: | 78 private: |
78 friend class base::RefCountedThreadSafe<AudioFrameInput>; | 79 friend class base::RefCountedThreadSafe<AudioFrameInput>; |
79 }; | 80 }; |
80 | 81 |
81 // Callback that is run to update the client with current status. This is used | 82 // Callback that is run to update the client with current status. This is used |
82 // to allow the client to wait for asynchronous initialization to complete | 83 // to allow the client to wait for asynchronous initialization to complete |
83 // before sending frames, and also to be notified of any runtime errors that | 84 // before sending frames, and also to be notified of any runtime errors that |
84 // have halted the session. | 85 // have halted the session. |
85 using StatusChangeCallback = base::Callback<void(OperationalStatus)>; | 86 using StatusChangeCallback = base::Callback<void(OperationalStatus)>; |
86 | 87 |
87 // All methods of CastSender must be called on the main thread. | 88 // All methods of CastSender must be called on the main thread. |
88 // Provided CastTransport will also be called on the main thread. | 89 // Provided CastTransport will also be called on the main thread. |
89 class CastSender { | 90 class CastSender { |
90 public: | 91 public: |
91 static scoped_ptr<CastSender> Create( | 92 static std::unique_ptr<CastSender> Create( |
92 scoped_refptr<CastEnvironment> cast_environment, | 93 scoped_refptr<CastEnvironment> cast_environment, |
93 CastTransport* const transport_sender); | 94 CastTransport* const transport_sender); |
94 | 95 |
95 virtual ~CastSender() {} | 96 virtual ~CastSender() {} |
96 | 97 |
97 // All video frames for the session should be inserted to this object. | 98 // All video frames for the session should be inserted to this object. |
98 virtual scoped_refptr<VideoFrameInput> video_frame_input() = 0; | 99 virtual scoped_refptr<VideoFrameInput> video_frame_input() = 0; |
99 | 100 |
100 // All audio frames for the session should be inserted to this object. | 101 // All audio frames for the session should be inserted to this object. |
101 virtual scoped_refptr<AudioFrameInput> audio_frame_input() = 0; | 102 virtual scoped_refptr<AudioFrameInput> audio_frame_input() = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
119 // Change the target delay. This is only valid if the receiver | 120 // Change the target delay. This is only valid if the receiver |
120 // supports the "adaptive_target_delay" rtp extension. | 121 // supports the "adaptive_target_delay" rtp extension. |
121 virtual void SetTargetPlayoutDelay( | 122 virtual void SetTargetPlayoutDelay( |
122 base::TimeDelta new_target_playout_delay) = 0; | 123 base::TimeDelta new_target_playout_delay) = 0; |
123 }; | 124 }; |
124 | 125 |
125 } // namespace cast | 126 } // namespace cast |
126 } // namespace media | 127 } // namespace media |
127 | 128 |
128 #endif // MEDIA_CAST_CAST_SENDER_H_ | 129 #endif // MEDIA_CAST_CAST_SENDER_H_ |
OLD | NEW |