| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 SetOptions(options); | 502 SetOptions(options); |
| 503 } | 503 } |
| 504 | 504 |
| 505 ~FakeVideoMediaChannel(); | 505 ~FakeVideoMediaChannel(); |
| 506 | 506 |
| 507 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } | 507 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } |
| 508 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } | 508 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } |
| 509 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } | 509 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } |
| 510 bool rendering() const { return playout(); } | 510 bool rendering() const { return playout(); } |
| 511 const VideoOptions& options() const { return options_; } | 511 const VideoOptions& options() const { return options_; } |
| 512 const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>& | 512 const std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*>& sinks() |
| 513 sinks() const { | 513 const { |
| 514 return sinks_; | 514 return sinks_; |
| 515 } | 515 } |
| 516 int max_bps() const { return max_bps_; } | 516 int max_bps() const { return max_bps_; } |
| 517 bool SetSendParameters(const VideoSendParameters& params) override { | 517 bool SetSendParameters(const VideoSendParameters& params) override { |
| 518 return (SetSendCodecs(params.codecs) && | 518 return (SetSendCodecs(params.codecs) && |
| 519 SetSendRtpHeaderExtensions(params.extensions) && | 519 SetSendRtpHeaderExtensions(params.extensions) && |
| 520 SetMaxSendBandwidth(params.max_bandwidth_bps)); | 520 SetMaxSendBandwidth(params.max_bandwidth_bps)); |
| 521 } | 521 } |
| 522 bool SetRecvParameters(const VideoRecvParameters& params) override { | 522 bool SetRecvParameters(const VideoRecvParameters& params) override { |
| 523 return (SetRecvCodecs(params.codecs) && | 523 return (SetRecvCodecs(params.codecs) && |
| 524 SetRecvRtpHeaderExtensions(params.extensions)); | 524 SetRecvRtpHeaderExtensions(params.extensions)); |
| 525 } | 525 } |
| 526 bool AddSendStream(const StreamParams& sp) override { | 526 bool AddSendStream(const StreamParams& sp) override { |
| 527 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); | 527 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); |
| 528 } | 528 } |
| 529 bool RemoveSendStream(uint32_t ssrc) override { | 529 bool RemoveSendStream(uint32_t ssrc) override { |
| 530 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); | 530 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); |
| 531 } | 531 } |
| 532 | 532 |
| 533 bool GetSendCodec(VideoCodec* send_codec) override { | 533 bool GetSendCodec(VideoCodec* send_codec) override { |
| 534 if (send_codecs_.empty()) { | 534 if (send_codecs_.empty()) { |
| 535 return false; | 535 return false; |
| 536 } | 536 } |
| 537 *send_codec = send_codecs_[0]; | 537 *send_codec = send_codecs_[0]; |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 bool SetSink(uint32_t ssrc, | 540 bool SetSink(uint32_t ssrc, |
| 541 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override { | 541 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { |
| 542 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { | 542 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { |
| 543 return false; | 543 return false; |
| 544 } | 544 } |
| 545 if (ssrc != 0) { | 545 if (ssrc != 0) { |
| 546 sinks_[ssrc] = sink; | 546 sinks_[ssrc] = sink; |
| 547 } | 547 } |
| 548 return true; | 548 return true; |
| 549 } | 549 } |
| 550 bool HasSink(uint32_t ssrc) const { | 550 bool HasSink(uint32_t ssrc) const { |
| 551 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; | 551 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; |
| 552 } | 552 } |
| 553 | 553 |
| 554 bool SetSend(bool send) override { return set_sending(send); } | 554 bool SetSend(bool send) override { return set_sending(send); } |
| 555 bool SetVideoSend( | 555 bool SetVideoSend( |
| 556 uint32_t ssrc, | 556 uint32_t ssrc, |
| 557 bool enable, | 557 bool enable, |
| 558 const VideoOptions* options, | 558 const VideoOptions* options, |
| 559 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override { | 559 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { |
| 560 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { | 560 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { |
| 561 return false; | 561 return false; |
| 562 } | 562 } |
| 563 if (enable && options) { | 563 if (enable && options) { |
| 564 if (!SetOptions(*options)) { | 564 if (!SetOptions(*options)) { |
| 565 return false; | 565 return false; |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 sources_[ssrc] = source; | 568 sources_[ssrc] = source; |
| 569 return true; | 569 return true; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 return true; | 611 return true; |
| 612 } | 612 } |
| 613 bool SetMaxSendBandwidth(int bps) { | 613 bool SetMaxSendBandwidth(int bps) { |
| 614 max_bps_ = bps; | 614 max_bps_ = bps; |
| 615 return true; | 615 return true; |
| 616 } | 616 } |
| 617 | 617 |
| 618 FakeVideoEngine* engine_; | 618 FakeVideoEngine* engine_; |
| 619 std::vector<VideoCodec> recv_codecs_; | 619 std::vector<VideoCodec> recv_codecs_; |
| 620 std::vector<VideoCodec> send_codecs_; | 620 std::vector<VideoCodec> send_codecs_; |
| 621 std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*> sinks_; | 621 std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*> sinks_; |
| 622 std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_; | 622 std::map<uint32_t, rtc::VideoSourceInterface<VideoFrame>*> sources_; |
| 623 VideoOptions options_; | 623 VideoOptions options_; |
| 624 int max_bps_; | 624 int max_bps_; |
| 625 }; | 625 }; |
| 626 | 626 |
| 627 // Dummy option class, needed for the DataTraits abstraction in | 627 // Dummy option class, needed for the DataTraits abstraction in |
| 628 // channel_unittest.c. | 628 // channel_unittest.c. |
| 629 class DataOptions {}; | 629 class DataOptions {}; |
| 630 | 630 |
| 631 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { | 631 class FakeDataMediaChannel : public RtpHelper<DataMediaChannel> { |
| 632 public: | 632 public: |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 959 |
| 960 private: | 960 private: |
| 961 std::vector<FakeDataMediaChannel*> channels_; | 961 std::vector<FakeDataMediaChannel*> channels_; |
| 962 std::vector<DataCodec> data_codecs_; | 962 std::vector<DataCodec> data_codecs_; |
| 963 DataChannelType last_channel_type_; | 963 DataChannelType last_channel_type_; |
| 964 }; | 964 }; |
| 965 | 965 |
| 966 } // namespace cricket | 966 } // namespace cricket |
| 967 | 967 |
| 968 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 968 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |