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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return false; | 332 return false; |
333 } | 333 } |
334 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) { | 334 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) { |
335 return false; | 335 return false; |
336 } | 336 } |
337 if (enable && options) { | 337 if (enable && options) { |
338 return SetOptions(*options); | 338 return SetOptions(*options); |
339 } | 339 } |
340 return true; | 340 return true; |
341 } | 341 } |
342 | |
343 bool HasSource(uint32_t ssrc) const { | |
344 return local_sinks_.find(ssrc) != local_sinks_.end(); | |
345 } | |
346 | |
347 virtual bool AddRecvStream(const StreamParams& sp) { | 342 virtual bool AddRecvStream(const StreamParams& sp) { |
348 if (!RtpHelper<VoiceMediaChannel>::AddRecvStream(sp)) | 343 if (!RtpHelper<VoiceMediaChannel>::AddRecvStream(sp)) |
349 return false; | 344 return false; |
350 output_scalings_[sp.first_ssrc()] = 1.0; | 345 output_scalings_[sp.first_ssrc()] = 1.0; |
351 return true; | 346 return true; |
352 } | 347 } |
353 virtual bool RemoveRecvStream(uint32_t ssrc) { | 348 virtual bool RemoveRecvStream(uint32_t ssrc) { |
354 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) | 349 if (!RtpHelper<VoiceMediaChannel>::RemoveRecvStream(ssrc)) |
355 return false; | 350 return false; |
356 output_scalings_.erase(ssrc); | 351 output_scalings_.erase(ssrc); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 bool SetSink(uint32_t ssrc, | 538 bool SetSink(uint32_t ssrc, |
544 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { | 539 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override { |
545 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { | 540 if (ssrc != 0 && sinks_.find(ssrc) == sinks_.end()) { |
546 return false; | 541 return false; |
547 } | 542 } |
548 if (ssrc != 0) { | 543 if (ssrc != 0) { |
549 sinks_[ssrc] = sink; | 544 sinks_[ssrc] = sink; |
550 } | 545 } |
551 return true; | 546 return true; |
552 } | 547 } |
553 bool HasSink(uint32_t ssrc) const { | |
554 return sinks_.find(ssrc) != sinks_.end() && sinks_.at(ssrc) != nullptr; | |
555 } | |
556 | 548 |
557 bool SetSend(bool send) override { return set_sending(send); } | 549 bool SetSend(bool send) override { return set_sending(send); } |
558 bool SetVideoSend( | 550 bool SetVideoSend( |
559 uint32_t ssrc, | 551 uint32_t ssrc, |
560 bool enable, | 552 bool enable, |
561 const VideoOptions* options, | 553 const VideoOptions* options, |
562 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { | 554 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override { |
563 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { | 555 if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) { |
564 return false; | 556 return false; |
565 } | 557 } |
566 if (enable && options) { | 558 if (enable && options) { |
567 if (!SetOptions(*options)) { | 559 return SetOptions(*options); |
568 return false; | |
569 } | |
570 } | 560 } |
571 sources_[ssrc] = source; | 561 sources_[ssrc] = source; |
572 return true; | 562 return true; |
573 } | 563 } |
574 | 564 |
575 bool HasSource(uint32_t ssrc) const { | 565 bool HasSource(uint32_t ssrc) const { |
576 return sources_.find(ssrc) != sources_.end() && | 566 return sources_.find(ssrc) != sources_.end(); |
577 sources_.at(ssrc) != nullptr; | |
578 } | 567 } |
579 bool AddRecvStream(const StreamParams& sp) override { | 568 bool AddRecvStream(const StreamParams& sp) override { |
580 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) | 569 if (!RtpHelper<VideoMediaChannel>::AddRecvStream(sp)) |
581 return false; | 570 return false; |
582 sinks_[sp.first_ssrc()] = NULL; | 571 sinks_[sp.first_ssrc()] = NULL; |
583 return true; | 572 return true; |
584 } | 573 } |
585 bool RemoveRecvStream(uint32_t ssrc) override { | 574 bool RemoveRecvStream(uint32_t ssrc) override { |
586 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) | 575 if (!RtpHelper<VideoMediaChannel>::RemoveRecvStream(ssrc)) |
587 return false; | 576 return false; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 951 |
963 private: | 952 private: |
964 std::vector<FakeDataMediaChannel*> channels_; | 953 std::vector<FakeDataMediaChannel*> channels_; |
965 std::vector<DataCodec> data_codecs_; | 954 std::vector<DataCodec> data_codecs_; |
966 DataChannelType last_channel_type_; | 955 DataChannelType last_channel_type_; |
967 }; | 956 }; |
968 | 957 |
969 } // namespace cricket | 958 } // namespace cricket |
970 | 959 |
971 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 960 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |