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 "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/time/tick_clock.h" | 17 #include "base/time/tick_clock.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "media/base/audio_bus.h" | 19 #include "media/base/audio_bus.h" |
20 #include "media/cast/cast_config.h" | 20 #include "media/cast/cast_config.h" |
21 #include "media/cast/cast_environment.h" | 21 #include "media/cast/cast_environment.h" |
22 #include "media/cast/transport/cast_transport_sender.h" | 22 #include "media/cast/net/cast_transport_sender.h" |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 class VideoFrame; | 25 class VideoFrame; |
26 | 26 |
27 namespace cast { | 27 namespace cast { |
28 class AudioSender; | 28 class AudioSender; |
29 class VideoSender; | 29 class VideoSender; |
30 | 30 |
31 class VideoFrameInput : public base::RefCountedThreadSafe<VideoFrameInput> { | 31 class VideoFrameInput : public base::RefCountedThreadSafe<VideoFrameInput> { |
32 public: | 32 public: |
(...skipping 23 matching lines...) Expand all Loading... |
56 private: | 56 private: |
57 friend class base::RefCountedThreadSafe<AudioFrameInput>; | 57 friend class base::RefCountedThreadSafe<AudioFrameInput>; |
58 }; | 58 }; |
59 | 59 |
60 // All methods of CastSender must be called on the main thread. | 60 // All methods of CastSender must be called on the main thread. |
61 // Provided CastTransportSender will also be called on the main thread. | 61 // Provided CastTransportSender will also be called on the main thread. |
62 class CastSender { | 62 class CastSender { |
63 public: | 63 public: |
64 static scoped_ptr<CastSender> Create( | 64 static scoped_ptr<CastSender> Create( |
65 scoped_refptr<CastEnvironment> cast_environment, | 65 scoped_refptr<CastEnvironment> cast_environment, |
66 transport::CastTransportSender* const transport_sender); | 66 CastTransportSender* const transport_sender); |
67 | 67 |
68 virtual ~CastSender() {} | 68 virtual ~CastSender() {} |
69 | 69 |
70 // All video frames for the session should be inserted to this object. | 70 // All video frames for the session should be inserted to this object. |
71 virtual scoped_refptr<VideoFrameInput> video_frame_input() = 0; | 71 virtual scoped_refptr<VideoFrameInput> video_frame_input() = 0; |
72 | 72 |
73 // All audio frames for the session should be inserted to this object. | 73 // All audio frames for the session should be inserted to this object. |
74 virtual scoped_refptr<AudioFrameInput> audio_frame_input() = 0; | 74 virtual scoped_refptr<AudioFrameInput> audio_frame_input() = 0; |
75 | 75 |
76 // All RTCP packets for the session should be inserted to this object. | 76 // All RTCP packets for the session should be inserted to this object. |
77 // This function and the callback must be called on the main thread. | 77 // This function and the callback must be called on the main thread. |
78 virtual transport::PacketReceiverCallback packet_receiver() = 0; | 78 virtual PacketReceiverCallback packet_receiver() = 0; |
79 | 79 |
80 // Initialize the audio stack. Must be called in order to send audio frames. | 80 // Initialize the audio stack. Must be called in order to send audio frames. |
81 // Status of the initialization will be returned on cast_initialization_cb. | 81 // Status of the initialization will be returned on cast_initialization_cb. |
82 virtual void InitializeAudio( | 82 virtual void InitializeAudio( |
83 const AudioSenderConfig& audio_config, | 83 const AudioSenderConfig& audio_config, |
84 const CastInitializationCallback& cast_initialization_cb) = 0; | 84 const CastInitializationCallback& cast_initialization_cb) = 0; |
85 | 85 |
86 // Initialize the video stack. Must be called in order to send video frames. | 86 // Initialize the video stack. Must be called in order to send video frames. |
87 // Status of the initialization will be returned on cast_initialization_cb. | 87 // Status of the initialization will be returned on cast_initialization_cb. |
88 virtual void InitializeVideo( | 88 virtual void InitializeVideo( |
89 const VideoSenderConfig& video_config, | 89 const VideoSenderConfig& video_config, |
90 const CastInitializationCallback& cast_initialization_cb, | 90 const CastInitializationCallback& cast_initialization_cb, |
91 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 91 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
92 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) = 0; | 92 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) = 0; |
93 }; | 93 }; |
94 | 94 |
95 } // namespace cast | 95 } // namespace cast |
96 } // namespace media | 96 } // namespace media |
97 | 97 |
98 #endif // MEDIA_CAST_CAST_SENDER_H_ | 98 #endif // MEDIA_CAST_CAST_SENDER_H_ |
OLD | NEW |