OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // VideoMediaChannel implementation | 160 // VideoMediaChannel implementation |
161 bool SetSendParameters(const VideoSendParameters& params) override; | 161 bool SetSendParameters(const VideoSendParameters& params) override; |
162 bool SetRecvParameters(const VideoRecvParameters& params) override; | 162 bool SetRecvParameters(const VideoRecvParameters& params) override; |
163 bool GetSendCodec(VideoCodec* send_codec) override; | 163 bool GetSendCodec(VideoCodec* send_codec) override; |
164 bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) override; | 164 bool SetSendStreamFormat(uint32_t ssrc, const VideoFormat& format) override; |
165 bool SetSend(bool send) override; | 165 bool SetSend(bool send) override; |
166 bool SetVideoSend(uint32_t ssrc, | 166 bool SetVideoSend(uint32_t ssrc, |
167 bool mute, | 167 bool mute, |
168 const VideoOptions* options) override; | 168 const VideoOptions* options) override; |
| 169 rtc::VideoSinkInterface<cricket::VideoFrame>* GetSink(uint32_t ssrc) override; |
169 bool AddSendStream(const StreamParams& sp) override; | 170 bool AddSendStream(const StreamParams& sp) override; |
170 bool RemoveSendStream(uint32_t ssrc) override; | 171 bool RemoveSendStream(uint32_t ssrc) override; |
171 bool AddRecvStream(const StreamParams& sp) override; | 172 bool AddRecvStream(const StreamParams& sp) override; |
172 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 173 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
173 bool RemoveRecvStream(uint32_t ssrc) override; | 174 bool RemoveRecvStream(uint32_t ssrc) override; |
174 bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) override; | 175 bool SetRenderer(uint32_t ssrc, VideoRenderer* renderer) override; |
175 bool GetStats(VideoMediaInfo* info) override; | 176 bool GetStats(VideoMediaInfo* info) override; |
176 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; | 177 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; |
177 bool SendIntraFrame() override; | 178 bool SendIntraFrame() override; |
178 bool RequestIntraFrame() override; | 179 bool RequestIntraFrame() override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 241 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
241 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 242 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
242 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 243 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
243 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 244 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
244 | 245 |
245 static std::string CodecSettingsVectorToString( | 246 static std::string CodecSettingsVectorToString( |
246 const std::vector<VideoCodecSettings>& codecs); | 247 const std::vector<VideoCodecSettings>& codecs); |
247 | 248 |
248 // Wrapper for the sender part, this is where the capturer is connected and | 249 // Wrapper for the sender part, this is where the capturer is connected and |
249 // frames are then converted from cricket frames to webrtc frames. | 250 // frames are then converted from cricket frames to webrtc frames. |
250 class WebRtcVideoSendStream : public sigslot::has_slots<> { | 251 class WebRtcVideoSendStream : |
| 252 public rtc::VideoSinkInterface<cricket::VideoFrame> { |
251 public: | 253 public: |
252 WebRtcVideoSendStream( | 254 WebRtcVideoSendStream( |
253 webrtc::Call* call, | 255 webrtc::Call* call, |
254 const StreamParams& sp, | 256 const StreamParams& sp, |
255 const webrtc::VideoSendStream::Config& config, | 257 const webrtc::VideoSendStream::Config& config, |
256 WebRtcVideoEncoderFactory* external_encoder_factory, | 258 WebRtcVideoEncoderFactory* external_encoder_factory, |
257 const VideoOptions& options, | 259 const VideoOptions& options, |
258 int max_bitrate_bps, | 260 int max_bitrate_bps, |
259 const rtc::Optional<VideoCodecSettings>& codec_settings, | 261 const rtc::Optional<VideoCodecSettings>& codec_settings, |
260 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 262 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
261 const VideoSendParameters& send_params); | 263 const VideoSendParameters& send_params); |
262 ~WebRtcVideoSendStream(); | 264 virtual ~WebRtcVideoSendStream(); |
263 | 265 |
264 void SetOptions(const VideoOptions& options); | 266 void SetOptions(const VideoOptions& options); |
265 // TODO(pbos): Move logic from SetOptions into this method. | 267 // TODO(pbos): Move logic from SetOptions into this method. |
266 void SetSendParameters(const ChangedSendParameters& send_params); | 268 void SetSendParameters(const ChangedSendParameters& send_params); |
267 | 269 |
268 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame); | 270 void OnFrame(const cricket::VideoFrame& frame) override; |
269 bool SetCapturer(VideoCapturer* capturer); | 271 bool SetCapturer(VideoCapturer* capturer); |
270 bool SetVideoFormat(const VideoFormat& format); | 272 bool SetVideoFormat(const VideoFormat& format); |
271 void MuteStream(bool mute); | 273 void MuteStream(bool mute); |
272 bool DisconnectCapturer(); | 274 bool DisconnectCapturer(); |
273 | 275 |
274 void Start(); | 276 void Start(); |
275 void Stop(); | 277 void Stop(); |
276 | 278 |
277 const std::vector<uint32_t>& GetSsrcs() const; | 279 const std::vector<uint32_t>& GetSsrcs() const; |
278 VideoSenderInfo GetVideoSenderInfo(); | 280 VideoSenderInfo GetVideoSenderInfo(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 369 |
368 rtc::CriticalSection lock_; | 370 rtc::CriticalSection lock_; |
369 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 371 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
370 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 372 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
371 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); | 373 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); |
372 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 374 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
373 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 375 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
374 Dimensions last_dimensions_ GUARDED_BY(lock_); | 376 Dimensions last_dimensions_ GUARDED_BY(lock_); |
375 | 377 |
376 VideoCapturer* capturer_ GUARDED_BY(lock_); | 378 VideoCapturer* capturer_ GUARDED_BY(lock_); |
| 379 // TODO(nisse): Keeping this flag here, caching |
| 380 // capturer_->IsScreencast(), is a temporary hack. The plan is to |
| 381 // move the screencast flag into VideoOptions. |
| 382 bool is_screencast_; |
377 bool sending_ GUARDED_BY(lock_); | 383 bool sending_ GUARDED_BY(lock_); |
378 bool muted_ GUARDED_BY(lock_); | 384 bool muted_ GUARDED_BY(lock_); |
379 VideoFormat format_ GUARDED_BY(lock_); | 385 VideoFormat format_ GUARDED_BY(lock_); |
380 int old_adapt_changes_ GUARDED_BY(lock_); | 386 int old_adapt_changes_ GUARDED_BY(lock_); |
381 | 387 |
382 // The timestamp of the first frame received | 388 // The timestamp of the first frame received |
383 // Used to generate the timestamps of subsequent frames | 389 // Used to generate the timestamps of subsequent frames |
384 int64_t first_frame_timestamp_ms_ GUARDED_BY(lock_); | 390 int64_t first_frame_timestamp_ms_ GUARDED_BY(lock_); |
385 | 391 |
386 // The timestamp of the last frame received | 392 // The timestamp of the last frame received |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 VideoOptions options_; | 538 VideoOptions options_; |
533 // TODO(deadbeef): Don't duplicate information between | 539 // TODO(deadbeef): Don't duplicate information between |
534 // send_params/recv_params, rtp_extensions, options, etc. | 540 // send_params/recv_params, rtp_extensions, options, etc. |
535 VideoSendParameters send_params_; | 541 VideoSendParameters send_params_; |
536 VideoRecvParameters recv_params_; | 542 VideoRecvParameters recv_params_; |
537 }; | 543 }; |
538 | 544 |
539 } // namespace cricket | 545 } // namespace cricket |
540 | 546 |
541 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 547 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |