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. All configuration are done | 5 // This is the main interface for the cast sender. All configuration are done |
6 // at creation. | 6 // at creation. |
7 // | 7 // |
8 // The FrameInput and PacketReciever interfaces should normally be accessed from | 8 // The FrameInput and PacketReciever interfaces should normally be accessed from |
9 // the IO thread. However they are allowed to be called from any thread. | 9 // the IO thread. However they are allowed to be called from any thread. |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 // the encoder is done with the frame; it does not mean that the encoded frame | 35 // the encoder is done with the frame; it does not mean that the encoded frame |
36 // has been sent out. | 36 // has been sent out. |
37 virtual void InsertRawVideoFrame( | 37 virtual void InsertRawVideoFrame( |
38 const scoped_refptr<media::VideoFrame>& video_frame, | 38 const scoped_refptr<media::VideoFrame>& video_frame, |
39 const base::TimeTicks& capture_time) = 0; | 39 const base::TimeTicks& capture_time) = 0; |
40 | 40 |
41 // The video_frame must be valid until the callback is called. | 41 // The video_frame must be valid until the callback is called. |
42 // The callback is called from the main cast thread as soon as | 42 // The callback is called from the main cast thread as soon as |
43 // the cast sender is done with the frame; it does not mean that the encoded | 43 // the cast sender is done with the frame; it does not mean that the encoded |
44 // frame has been sent out. | 44 // frame has been sent out. |
45 virtual void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, | 45 virtual void InsertCodedVideoFrame( |
46 const base::TimeTicks& capture_time, | 46 const transport::EncodedVideoFrame* video_frame, |
47 const base::Closure callback) = 0; | 47 const base::TimeTicks& capture_time, |
| 48 const base::Closure callback) = 0; |
48 | 49 |
49 // The |audio_bus| must be valid until the |done_callback| is called. | 50 // The |audio_bus| must be valid until the |done_callback| is called. |
50 // The callback is called from the main cast thread as soon as the encoder is | 51 // The callback is called from the main cast thread as soon as the encoder is |
51 // done with |audio_bus|; it does not mean that the encoded data has been | 52 // done with |audio_bus|; it does not mean that the encoded data has been |
52 // sent out. | 53 // sent out. |
53 virtual void InsertAudio(const AudioBus* audio_bus, | 54 virtual void InsertAudio(const AudioBus* audio_bus, |
54 const base::TimeTicks& recorded_time, | 55 const base::TimeTicks& recorded_time, |
55 const base::Closure& done_callback) = 0; | 56 const base::Closure& done_callback) = 0; |
56 | 57 |
57 // The audio_frame must be valid until the callback is called. | 58 // The audio_frame must be valid until the callback is called. |
58 // The callback is called from the main cast thread as soon as | 59 // The callback is called from the main cast thread as soon as |
59 // the cast sender is done with the frame; it does not mean that the encoded | 60 // the cast sender is done with the frame; it does not mean that the encoded |
60 // frame has been sent out. | 61 // frame has been sent out. |
61 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, | 62 virtual void InsertCodedAudioFrame( |
62 const base::TimeTicks& recorded_time, | 63 const transport::EncodedAudioFrame* audio_frame, |
63 const base::Closure callback) = 0; | 64 const base::TimeTicks& recorded_time, |
| 65 const base::Closure callback) = 0; |
64 | 66 |
65 protected: | 67 protected: |
66 virtual ~FrameInput() {} | 68 virtual ~FrameInput() {} |
67 | 69 |
68 private: | 70 private: |
69 friend class base::RefCountedThreadSafe<FrameInput>; | 71 friend class base::RefCountedThreadSafe<FrameInput>; |
70 }; | 72 }; |
71 | 73 |
72 // This Class is thread safe. | 74 // This Class is thread safe. |
73 // The provided PacketSender object will always be called form the main cast | 75 // The provided PacketSender object will always be called form the main cast |
74 // thread. | 76 // thread. |
75 class CastSender { | 77 class CastSender { |
76 public: | 78 public: |
77 static CastSender* CreateCastSender( | 79 static CastSender* CreateCastSender( |
78 scoped_refptr<CastEnvironment> cast_environment, | 80 scoped_refptr<CastEnvironment> cast_environment, |
79 const AudioSenderConfig& audio_config, | 81 const AudioSenderConfig& audio_config, |
80 const VideoSenderConfig& video_config, | 82 const VideoSenderConfig& video_config, |
81 VideoEncoderController* const video_encoder_controller, | 83 VideoEncoderController* const video_encoder_controller, |
82 PacketSender* const packet_sender); | 84 PacketSender* const packet_sender); |
83 | 85 |
84 virtual ~CastSender() {} | 86 virtual ~CastSender() {} |
85 | 87 |
86 // All audio and video frames for the session should be inserted to this | 88 // All audio and video frames for the session should be inserted to this |
87 // object. | 89 // object. |
88 // Can be called from any thread. | 90 // Can be called from any thread. |
89 virtual scoped_refptr<FrameInput> frame_input() = 0; | 91 virtual scoped_refptr<FrameInput> frame_input() = 0; |
90 | 92 |
91 // All RTCP packets for the session should be inserted to this object. | 93 // All RTCP packets for the session should be inserted to this object. |
92 // Can be called from any thread. | 94 // Can be called from any thread. |
93 virtual scoped_refptr<PacketReceiver> packet_receiver() = 0; | 95 virtual scoped_refptr<transport::PacketReceiver> packet_receiver() = 0; |
94 }; | 96 }; |
95 | 97 |
96 } // namespace cast | 98 } // namespace cast |
97 } // namespace media | 99 } // namespace media |
98 | 100 |
99 #endif // MEDIA_CAST_CAST_SENDER_H_ | 101 #endif // MEDIA_CAST_CAST_SENDER_H_ |
OLD | NEW |