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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } | 475 const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; } |
476 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } | 476 const std::vector<VideoCodec>& send_codecs() const { return send_codecs_; } |
477 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } | 477 const std::vector<VideoCodec>& codecs() const { return send_codecs(); } |
478 bool rendering() const { return playout(); } | 478 bool rendering() const { return playout(); } |
479 const VideoOptions& options() const { return options_; } | 479 const VideoOptions& options() const { return options_; } |
480 const std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*>& sinks() | 480 const std::map<uint32_t, rtc::VideoSinkInterface<VideoFrame>*>& sinks() |
481 const { | 481 const { |
482 return sinks_; | 482 return sinks_; |
483 } | 483 } |
484 int max_bps() const { return max_bps_; } | 484 int max_bps() const { return max_bps_; } |
485 bool SetSendParameters(const VideoSendParameters& params) override { | 485 virtual bool SetSendParameters(const VideoSendParameters& params) { |
486 return (SetSendCodecs(params.codecs) && | 486 return (SetSendCodecs(params.codecs) && |
487 SetSendRtpHeaderExtensions(params.extensions) && | 487 SetSendRtpHeaderExtensions(params.extensions) && |
488 SetMaxSendBandwidth(params.max_bandwidth_bps)); | 488 SetMaxSendBandwidth(params.max_bandwidth_bps)); |
489 } | 489 } |
490 bool SetRecvParameters(const VideoRecvParameters& params) override { | 490 virtual bool SetRecvParameters(const VideoRecvParameters& params) { |
491 return (SetRecvCodecs(params.codecs) && | 491 return (SetRecvCodecs(params.codecs) && |
492 SetRecvRtpHeaderExtensions(params.extensions)); | 492 SetRecvRtpHeaderExtensions(params.extensions)); |
493 } | 493 } |
494 bool AddSendStream(const StreamParams& sp) override { | 494 virtual bool AddSendStream(const StreamParams& sp) { |
495 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); | 495 return RtpHelper<VideoMediaChannel>::AddSendStream(sp); |
496 } | 496 } |
497 bool RemoveSendStream(uint32_t ssrc) override { | 497 virtual bool RemoveSendStream(uint32_t ssrc) { |
498 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); | 498 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); |
499 } | 499 } |
500 | 500 |
501 bool GetSendCodec(VideoCodec* send_codec) override { | 501 virtual bool GetSendCodec(VideoCodec* send_codec) { |
502 if (send_codecs_.empty()) { | 502 if (send_codecs_.empty()) { |
503 return false; | 503 return false; |
504 } | 504 } |
505 *send_codec = send_codecs_[0]; | 505 *send_codec = send_codecs_[0]; |
506 return true; | 506 return true; |
507 } | 507 } |
508 bool SetSink(uint32_t ssrc, | 508 bool SetSink(uint32_t ssrc, |
509 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { | 509 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { |
510 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { | 510 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { |
511 return false; | 511 return false; |
512 } | 512 } |
513 if (ssrc != 0) { | 513 if (ssrc != 0) { |
514 sinks_[ssrc] = sink; | 514 sinks_[ssrc] = sink; |
515 } | 515 } |
516 return true; | 516 return true; |
517 } | 517 } |
518 | 518 |
519 bool SetSend(bool send) override { return set_sending(send); } | 519 virtual bool SetSend(bool send) { return set_sending(send); } |
520 bool SetVideoSend(uint32_t ssrc, bool enable, | 520 virtual bool SetVideoSend(uint32_t ssrc, bool enable, |
521 const VideoOptions* options) override { | 521 const VideoOptions* options) { |
522 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { | 522 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { |
523 return false; | 523 return false; |
524 } | 524 } |
525 if (enable && options) { | 525 if (enable && options) { |
526 return SetOptions(*options); | 526 return SetOptions(*options); |
527 } | 527 } |
528 return true; | 528 return true; |
529 } | 529 } |
530 void SetSource( | 530 void SetSource( |
531 uint32_t ssrc, | 531 uint32_t ssrc, |
532 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { | 532 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { |
533 sources_[ssrc] = source; | 533 sources_[ssrc] = source; |
534 } | 534 } |
535 | 535 |
536 bool HasSource(uint32_t ssrc) const { | 536 bool HasSource(uint32_t ssrc) const { |
537 return sources_.find(ssrc) != sources_.end(); | 537 return sources_.find(ssrc) != sources_.end(); |
538 } | 538 } |
539 bool AddRecvStream(const StreamParams& sp) override { | 539 virtual bool AddRecvStream(const StreamParams& sp) { |
540 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) | 540 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) |
541 return false; | 541 return false; |
542 sinks_[sp.first_ssrc()] = NULL; | 542 sinks_[sp.first_ssrc()] = NULL; |
543 return true; | 543 return true; |
544 } | 544 } |
545 bool RemoveRecvStream(uint32_t ssrc) override { | 545 virtual bool RemoveRecvStream(uint32_t ssrc) { |
546 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) | 546 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) |
547 return false; | 547 return false; |
548 sinks_.erase(ssrc); | 548 sinks_.erase(ssrc); |
549 return true; | 549 return true; |
550 } | 550 } |
551 | 551 |
552 bool GetStats(VideoMediaInfo* info) override { return false; } | 552 virtual bool GetStats(VideoMediaInfo* info) { return false; } |
553 | 553 |
554 private: | 554 private: |
555 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { | 555 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { |
556 if (fail_set_recv_codecs()) { | 556 if (fail_set_recv_codecs()) { |
557 // Fake the failure in SetRecvCodecs. | 557 // Fake the failure in SetRecvCodecs. |
558 return false; | 558 return false; |
559 } | 559 } |
560 recv_codecs_ = codecs; | 560 recv_codecs_ = codecs; |
561 return true; | 561 return true; |
562 } | 562 } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 907 |
908 private: | 908 private: |
909 std::vector<FakeDataMediaChannel*> channels_; | 909 std::vector<FakeDataMediaChannel*> channels_; |
910 std::vector<DataCodec> data_codecs_; | 910 std::vector<DataCodec> data_codecs_; |
911 DataChannelType last_channel_type_; | 911 DataChannelType last_channel_type_; |
912 }; | 912 }; |
913 | 913 |
914 } // namespace cricket | 914 } // namespace cricket |
915 | 915 |
916 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 916 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |