OLD | NEW |
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 SetOptions(options); | 511 SetOptions(options); |
512 } | 512 } |
513 | 513 |
514 ~FakeVideoMediaChannel(); | 514 ~FakeVideoMediaChannel(); |
515 | 515 |
516 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } | 516 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } |
517 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } | 517 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } |
518 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } | 518 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } |
519 bool rendering() const { return playout(); } | 519 bool rendering() const { return playout(); } |
520 const VideoOptions& options() const { return options_; } | 520 const VideoOptions& options() const { return options_; } |
521 const std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*>& sinks() | 521 const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>& |
522 const { | 522 sinks() const { |
523 return sinks_; | 523 return sinks_; |
524 } | 524 } |
525 int max_bps() const { return max_bps_; } | 525 int max_bps() const { return max_bps_; } |
526 bool SetSendParameters(const VideoSendParameters& params) override { | 526 bool SetSendParameters(const VideoSendParameters& params) override { |
527 return (SetSendCodecs(params.codecs) && | 527 return (SetSendCodecs(params.codecs) && |
528 SetSendRtpHeaderExtensions(params.extensions) && | 528 SetSendRtpHeaderExtensions(params.extensions) && |
529 SetMaxSendBandwidth(params.max_bandwidth_bps)); | 529 SetMaxSendBandwidth(params.max_bandwidth_bps)); |
530 } | 530 } |
531 bool SetRecvParameters(const VideoRecvParameters& params) override { | 531 bool SetRecvParameters(const VideoRecvParameters& params) override { |
532 return (SetRecvCodecs(params.codecs) && | 532 return (SetRecvCodecs(params.codecs) && |
533 SetRecvRtpHeaderExtensions(params.extensions)); | 533 SetRecvRtpHeaderExtensions(params.extensions)); |
534 } | 534 } |
535 bool AddSendStream(const StreamParams& sp) override { | 535 bool AddSendStream(const StreamParams& sp) override { |
536 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); | 536 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); |
537 } | 537 } |
538 bool RemoveSendStream(uint32_t ssrc) override { | 538 bool RemoveSendStream(uint32_t ssrc) override { |
539 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); | 539 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); |
540 } | 540 } |
541 | 541 |
542 bool GetSendCodec(VideoCodec* send_codec) override { | 542 bool GetSendCodec(VideoCodec* send_codec) override { |
543 if (send_codecs_.empty()) { | 543 if (send_codecs_.empty()) { |
544 return false; | 544 return false; |
545 } | 545 } |
546 *send_codec = send_codecs_[0]; | 546 *send_codec = send_codecs_[0]; |
547 return true; | 547 return true; |
548 } | 548 } |
549 bool SetSink(uint32_t ssrc, | 549 bool SetSink(uint32_t ssrc, |
550 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { | 550 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override { |
551 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { | 551 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { |
552 return false; | 552 return false; |
553 } | 553 } |
554 if (ssrc != 0) { | 554 if (ssrc != 0) { |
555 sinks_[ssrc] = sink; | 555 sinks_[ssrc] = sink; |
556 } | 556 } |
557 return true; | 557 return true; |
558 } | 558 } |
559 bool HasSink(uint32_t ssrc) const { | 559 bool HasSink(uint32_t ssrc) const { |
560 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; | 560 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; |
561 } | 561 } |
562 | 562 |
563 bool SetSend(bool send) override { return set_sending(send); } | 563 bool SetSend(bool send) override { return set_sending(send); } |
564 bool SetVideoSend( | 564 bool SetVideoSend( |
565 uint32_t ssrc, | 565 uint32_t ssrc, |
566 bool enable, | 566 bool enable, |
567 const VideoOptions* options, | 567 const VideoOptions* options, |
568 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { | 568 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override { |
569 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { | 569 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { |
570 return false; | 570 return false; |
571 } | 571 } |
572 if (enable && options) { | 572 if (enable && options) { |
573 if (!SetOptions(*options)) { | 573 if (!SetOptions(*options)) { |
574 return false; | 574 return false; |
575 } | 575 } |
576 } | 576 } |
577 sources_[ssrc] = source; | 577 sources_[ssrc] = source; |
578 return true; | 578 return true; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 return true; | 620 return true; |
621 } | 621 } |
622 bool SetMaxSendBandwidth(int bps) { | 622 bool SetMaxSendBandwidth(int bps) { |
623 max_bps_ = bps; | 623 max_bps_ = bps; |
624 return true; | 624 return true; |
625 } | 625 } |
626 | 626 |
627 FakeVideoEngine* engine_; | 627 FakeVideoEngine* engine_; |
628 std::vector<VideoCodec> recv_codecs_; | 628 std::vector<VideoCodec> recv_codecs_; |
629 std::vector<VideoCodec> send_codecs_; | 629 std::vector<VideoCodec> send_codecs_; |
630 std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*> sinks_; | 630 std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*> sinks_; |
631 std::map<uint32_t, rtc::VideoSourceInterface<VideoFrame>*> sources_; | 631 std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_; |
632 VideoOptions options_; | 632 VideoOptions options_; |
633 int max_bps_; | 633 int max_bps_; |
634 }; | 634 }; |
635 | 635 |
636 // Dummy option class, needed for the DataTraits abstraction in | 636 // Dummy option class, needed for the DataTraits abstraction in |
637 // channel_unittest.c. | 637 // channel_unittest.c. |
638 class DataOptions {}; | 638 class DataOptions {}; |
639 | 639 |
640 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { | 640 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { |
641 public: | 641 public: |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 968 |
969 private: | 969 private: |
970 std::vector<FakeDataMediaChannel*> channels_; | 970 std::vector<FakeDataMediaChannel*> channels_; |
971 std::vector<DataCodec> data_codecs_; | 971 std::vector<DataCodec> data_codecs_; |
972 DataChannelType last_channel_type_; | 972 DataChannelType last_channel_type_; |
973 }; | 973 }; |
974 | 974 |
975 } // namespace cricket | 975 } // namespace cricket |
976 | 976 |
977 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 977 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |