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

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2.h

Issue 1269863005: MediaController/Call instantiation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+comments Created 5 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 /* 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 uint32_t ssrc) override; 96 uint32_t ssrc) override;
97 97
98 VideoRenderer* GetDefaultRenderer() const; 98 VideoRenderer* GetDefaultRenderer() const;
99 void SetDefaultRenderer(VideoMediaChannel* channel, VideoRenderer* renderer); 99 void SetDefaultRenderer(VideoMediaChannel* channel, VideoRenderer* renderer);
100 100
101 private: 101 private:
102 uint32_t default_recv_ssrc_; 102 uint32_t default_recv_ssrc_;
103 VideoRenderer* default_renderer_; 103 VideoRenderer* default_renderer_;
104 }; 104 };
105 105
106 // CallFactory, overridden for testing to verify that webrtc::Call is configured 106 // WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
107 // properly. 107 class WebRtcVideoEngine2 {
108 class WebRtcCallFactory {
109 public: 108 public:
110 virtual ~WebRtcCallFactory(); 109 WebRtcVideoEngine2();
111 virtual webrtc::Call* CreateCall(const webrtc::Call::Config& config); 110 ~WebRtcVideoEngine2();
112 };
113
114 // WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
115 class WebRtcVideoEngine2 : public sigslot::has_slots<> {
116 public:
117 explicit WebRtcVideoEngine2(WebRtcVoiceEngine* voice_engine);
118 virtual ~WebRtcVideoEngine2();
119
120 // Used for testing to be able to check and use the webrtc::Call config.
121 void SetCallFactory(WebRtcCallFactory* call_factory);
122 111
123 // Basic video engine implementation. 112 // Basic video engine implementation.
124 void Init(); 113 void Init();
125 114
126 int GetCapabilities(); 115 int GetCapabilities();
127 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config); 116 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
128 117
129 WebRtcVideoChannel2* CreateChannel(const VideoOptions& options, 118 WebRtcVideoChannel2* CreateChannel(webrtc::Call* call,
130 VoiceMediaChannel* voice_channel); 119 const VideoOptions& options);
131 120
132 const std::vector<VideoCodec>& codecs() const; 121 const std::vector<VideoCodec>& codecs() const;
133 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const; 122 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
134 void SetLogging(int min_sev, const char* filter); 123 void SetLogging(int min_sev, const char* filter);
135 124
136 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does 125 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does
137 // not take the ownership of |decoder_factory|. The caller needs to make sure 126 // not take the ownership of |decoder_factory|. The caller needs to make sure
138 // that |decoder_factory| outlives the video engine. 127 // that |decoder_factory| outlives the video engine.
139 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory); 128 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory);
140 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does 129 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does
141 // not take the ownership of |encoder_factory|. The caller needs to make sure 130 // not take the ownership of |encoder_factory|. The caller needs to make sure
142 // that |encoder_factory| outlives the video engine. 131 // that |encoder_factory| outlives the video engine.
143 virtual void SetExternalEncoderFactory( 132 virtual void SetExternalEncoderFactory(
144 WebRtcVideoEncoderFactory* encoder_factory); 133 WebRtcVideoEncoderFactory* encoder_factory);
145 134
146 bool EnableTimedRender(); 135 bool EnableTimedRender();
147 136
148 bool FindCodec(const VideoCodec& in); 137 bool FindCodec(const VideoCodec& in);
149 bool CanSendCodec(const VideoCodec& in, 138 bool CanSendCodec(const VideoCodec& in,
150 const VideoCodec& current, 139 const VideoCodec& current,
151 VideoCodec* out); 140 VideoCodec* out);
152 // Check whether the supplied trace should be ignored. 141 // Check whether the supplied trace should be ignored.
153 bool ShouldIgnoreTrace(const std::string& trace); 142 bool ShouldIgnoreTrace(const std::string& trace);
154 143
155 private: 144 private:
156 std::vector<VideoCodec> GetSupportedCodecs() const; 145 std::vector<VideoCodec> GetSupportedCodecs() const;
157 146
158 WebRtcVoiceEngine* voice_engine_;
159 std::vector<VideoCodec> video_codecs_; 147 std::vector<VideoCodec> video_codecs_;
160 std::vector<RtpHeaderExtension> rtp_header_extensions_; 148 std::vector<RtpHeaderExtension> rtp_header_extensions_;
161 149
162 bool initialized_; 150 bool initialized_;
163 151
164 WebRtcCallFactory default_call_factory_;
165 WebRtcCallFactory* call_factory_;
166
167 WebRtcVideoDecoderFactory* external_decoder_factory_; 152 WebRtcVideoDecoderFactory* external_decoder_factory_;
168 WebRtcVideoEncoderFactory* external_encoder_factory_; 153 WebRtcVideoEncoderFactory* external_encoder_factory_;
169 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; 154 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_;
170 }; 155 };
171 156
172 class WebRtcVideoChannel2 : public rtc::MessageHandler, 157 class WebRtcVideoChannel2 : public rtc::MessageHandler,
173 public VideoMediaChannel, 158 public VideoMediaChannel,
174 public webrtc::newapi::Transport, 159 public webrtc::newapi::Transport,
175 public webrtc::LoadObserver { 160 public webrtc::LoadObserver {
176 public: 161 public:
177 WebRtcVideoChannel2(WebRtcCallFactory* call_factory, 162 WebRtcVideoChannel2(webrtc::Call* call,
178 WebRtcVoiceEngine* voice_engine,
179 WebRtcVoiceMediaChannel* voice_channel,
180 const VideoOptions& options, 163 const VideoOptions& options,
181 WebRtcVideoEncoderFactory* external_encoder_factory, 164 WebRtcVideoEncoderFactory* external_encoder_factory,
182 WebRtcVideoDecoderFactory* external_decoder_factory); 165 WebRtcVideoDecoderFactory* external_decoder_factory);
183 ~WebRtcVideoChannel2(); 166 ~WebRtcVideoChannel2() override;
184 bool Init();
185 167
186 // VideoMediaChannel implementation 168 // VideoMediaChannel implementation
187 void DetachVoiceChannel() override;
188 bool SetSendParameters(const VideoSendParameters& params) override; 169 bool SetSendParameters(const VideoSendParameters& params) override;
189 bool SetRecvParameters(const VideoRecvParameters& params) override; 170 bool SetRecvParameters(const VideoRecvParameters& params) override;
190 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) override; 171 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) override;
191 bool SetSendCodecs(const std::vector<VideoCodec>& codecs) override; 172 bool SetSendCodecs(const std::vector<VideoCodec>& codecs) override;
192 bool GetSendCodec(VideoCodec* send_codec) override; 173 bool GetSendCodec(VideoCodec* send_codec) override;
193 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; 174 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override;
194 bool SetRender(bool render) override; 175 bool SetRender(bool render) override;
195 bool SetSend(bool send) override; 176 bool SetSend(bool send) override;
196 177
197 bool AddSendStream(const StreamParams& sp) override; 178 bool AddSendStream(const StreamParams& sp) override;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 484
504 void FillSenderStats(VideoMediaInfo* info); 485 void FillSenderStats(VideoMediaInfo* info);
505 void FillReceiverStats(VideoMediaInfo* info); 486 void FillReceiverStats(VideoMediaInfo* info);
506 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats, 487 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats,
507 VideoMediaInfo* info); 488 VideoMediaInfo* info);
508 489
509 rtc::ThreadChecker thread_checker_; 490 rtc::ThreadChecker thread_checker_;
510 491
511 uint32_t rtcp_receiver_report_ssrc_; 492 uint32_t rtcp_receiver_report_ssrc_;
512 bool sending_; 493 bool sending_;
513 rtc::scoped_ptr<webrtc::Call> call_; 494 webrtc::Call* call_;
pbos-webrtc 2015/09/08 14:47:41 Call* const
the sun 2015/09/08 15:21:35 Do you mean I should use a reference (&) instead?
514 WebRtcCallFactory* call_factory_;
515 495
516 uint32_t default_send_ssrc_; 496 uint32_t default_send_ssrc_;
517 497
518 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; 498 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
519 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; 499 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
520 500
521 // Separate list of set capturers used to signal CPU adaptation. These should 501 // Separate list of set capturers used to signal CPU adaptation. These should
522 // not be locked while calling methods that take other locks to prevent 502 // not be locked while calling methods that take other locks to prevent
523 // lock-order inversions. 503 // lock-order inversions.
524 rtc::CriticalSection capturer_crit_; 504 rtc::CriticalSection capturer_crit_;
525 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); 505 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_);
526 std::map<uint32, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); 506 std::map<uint32, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_);
527 507
528 rtc::CriticalSection stream_crit_; 508 rtc::CriticalSection stream_crit_;
529 // Using primary-ssrc (first ssrc) as key. 509 // Using primary-ssrc (first ssrc) as key.
530 std::map<uint32, WebRtcVideoSendStream*> send_streams_ 510 std::map<uint32, WebRtcVideoSendStream*> send_streams_
531 GUARDED_BY(stream_crit_); 511 GUARDED_BY(stream_crit_);
532 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_ 512 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_
533 GUARDED_BY(stream_crit_); 513 GUARDED_BY(stream_crit_);
534 std::set<uint32> send_ssrcs_ GUARDED_BY(stream_crit_); 514 std::set<uint32> send_ssrcs_ GUARDED_BY(stream_crit_);
535 std::set<uint32> receive_ssrcs_ GUARDED_BY(stream_crit_); 515 std::set<uint32> receive_ssrcs_ GUARDED_BY(stream_crit_);
536 516
537 Settable<VideoCodecSettings> send_codec_; 517 Settable<VideoCodecSettings> send_codec_;
538 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 518 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
539 519
540 WebRtcVoiceMediaChannel* voice_channel_;
541 const int voice_channel_id_;
542 WebRtcVideoEncoderFactory* const external_encoder_factory_; 520 WebRtcVideoEncoderFactory* const external_encoder_factory_;
543 WebRtcVideoDecoderFactory* const external_decoder_factory_; 521 WebRtcVideoDecoderFactory* const external_decoder_factory_;
544 std::vector<VideoCodecSettings> recv_codecs_; 522 std::vector<VideoCodecSettings> recv_codecs_;
545 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 523 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
546 webrtc::Call::Config::BitrateConfig bitrate_config_; 524 webrtc::Call::Config::BitrateConfig bitrate_config_;
547 VideoOptions options_; 525 VideoOptions options_;
548 }; 526 };
549 527
550 } // namespace cricket 528 } // namespace cricket
551 529
552 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ 530 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698