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

Side by Side Diff: webrtc/media/base/fakemediaengine.h

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Make SetSource tolerate unknown ssrc and source == NULL. Created 4 years, 9 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 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 virtual bool SetVideoSend(uint32_t ssrc, bool enable, 481 virtual bool SetVideoSend(uint32_t ssrc, bool enable,
482 const VideoOptions* options) { 482 const VideoOptions* options) {
483 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { 483 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) {
484 return false; 484 return false;
485 } 485 }
486 if (enable && options) { 486 if (enable && options) {
487 return SetOptions(*options); 487 return SetOptions(*options);
488 } 488 }
489 return true; 489 return true;
490 } 490 }
491 virtual bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { 491 void SetSource(
492 capturers_[ssrc] = capturer; 492 uint32_t ssrc,
493 return true; 493 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override {
494 sources_[ssrc] = source;
494 } 495 }
495 bool HasCapturer(uint32_t ssrc) const { 496
496 return capturers_.find(ssrc) != capturers_.end(); 497 bool HasSource(uint32_t ssrc) const {
498 return sources_.find(ssrc) != sources_.end();
497 } 499 }
498 virtual bool AddRecvStream(const StreamParams& sp) { 500 virtual bool AddRecvStream(const StreamParams& sp) {
499 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) 501 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp))
500 return false; 502 return false;
501 sinks_[sp.first_ssrc()] = NULL; 503 sinks_[sp.first_ssrc()] = NULL;
502 return true; 504 return true;
503 } 505 }
504 virtual bool RemoveRecvStream(uint32_t ssrc) { 506 virtual bool RemoveRecvStream(uint32_t ssrc) {
505 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) 507 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc))
506 return false; 508 return false;
(...skipping 27 matching lines...) Expand all
534 } 536 }
535 bool SetMaxSendBandwidth(int bps) { 537 bool SetMaxSendBandwidth(int bps) {
536 max_bps_ = bps; 538 max_bps_ = bps;
537 return true; 539 return true;
538 } 540 }
539 541
540 FakeVideoEngine* engine_; 542 FakeVideoEngine* engine_;
541 std::vector<VideoCodec> recv_codecs_; 543 std::vector<VideoCodec> recv_codecs_;
542 std::vector<VideoCodec> send_codecs_; 544 std::vector<VideoCodec> send_codecs_;
543 std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*> sinks_; 545 std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*> sinks_;
544 std::map<uint32_t, VideoCapturer*> capturers_; 546 std::map<uint32_t, rtc::VideoSourceInterface<VideoFrame>*> sources_;
545 VideoOptions options_; 547 VideoOptions options_;
546 int max_bps_; 548 int max_bps_;
547 }; 549 };
548 550
549 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { 551 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> {
550 public: 552 public:
551 explicit FakeDataMediaChannel(void* unused, const DataOptions& options) 553 explicit FakeDataMediaChannel(void* unused, const DataOptions& options)
552 : send_blocked_(false), max_bps_(-1) {} 554 : send_blocked_(false), max_bps_(-1) {}
553 ~FakeDataMediaChannel() {} 555 ~FakeDataMediaChannel() {}
554 const std::vector<DataCodec>& recv_codecs() const { return recv_codecs_; } 556 const std::vector<DataCodec>& recv_codecs() const { return recv_codecs_; }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 871
870 private: 872 private:
871 std::vector<FakeDataMediaChannel*> channels_; 873 std::vector<FakeDataMediaChannel*> channels_;
872 std::vector<DataCodec> data_codecs_; 874 std::vector<DataCodec> data_codecs_;
873 DataChannelType last_channel_type_; 875 DataChannelType last_channel_type_;
874 }; 876 };
875 877
876 } // namespace cricket 878 } // namespace cricket
877 879
878 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 880 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698