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

Side by Side Diff: talk/media/base/mediachannel.h

Issue 1363573002: Wire up transport sequence number / send time callbacks to webrtc via libjingle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing updated_options Created 5 years, 2 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 enum DtmfFlags { 497 enum DtmfFlags {
498 DF_PLAY = 0x01, 498 DF_PLAY = 0x01,
499 DF_SEND = 0x02, 499 DF_SEND = 0x02,
500 }; 500 };
501 501
502 class MediaChannel : public sigslot::has_slots<> { 502 class MediaChannel : public sigslot::has_slots<> {
503 public: 503 public:
504 class NetworkInterface { 504 class NetworkInterface {
505 public: 505 public:
506 enum SocketType { ST_RTP, ST_RTCP }; 506 enum SocketType { ST_RTP, ST_RTCP };
507 virtual bool SendPacket( 507 virtual bool SendPacket(rtc::Buffer* packet,
508 rtc::Buffer* packet, 508 const rtc::PacketOptions& options) = 0;
509 rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0; 509 virtual bool SendRtcp(rtc::Buffer* packet,
510 virtual bool SendRtcp( 510 const rtc::PacketOptions& options) = 0;
511 rtc::Buffer* packet,
512 rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0;
513 virtual int SetOption(SocketType type, rtc::Socket::Option opt, 511 virtual int SetOption(SocketType type, rtc::Socket::Option opt,
514 int option) = 0; 512 int option) = 0;
515 virtual ~NetworkInterface() {} 513 virtual ~NetworkInterface() {}
516 }; 514 };
517 515
518 MediaChannel() : network_interface_(NULL) {} 516 MediaChannel() : network_interface_(NULL) {}
519 virtual ~MediaChannel() {} 517 virtual ~MediaChannel() {}
520 518
521 // Sets the abstract interface class for sending RTP/RTCP data. 519 // Sets the abstract interface class for sending RTP/RTCP data.
522 virtual void SetInterface(NetworkInterface *iface) { 520 virtual void SetInterface(NetworkInterface *iface) {
(...skipping 23 matching lines...) Expand all
546 // ssrc must be the first SSRC of the media stream if the stream uses 544 // ssrc must be the first SSRC of the media stream if the stream uses
547 // multiple SSRCs. 545 // multiple SSRCs.
548 virtual bool RemoveRecvStream(uint32_t ssrc) = 0; 546 virtual bool RemoveRecvStream(uint32_t ssrc) = 0;
549 547
550 // Returns the absoulte sendtime extension id value from media channel. 548 // Returns the absoulte sendtime extension id value from media channel.
551 virtual int GetRtpSendTimeExtnId() const { 549 virtual int GetRtpSendTimeExtnId() const {
552 return -1; 550 return -1;
553 } 551 }
554 552
555 // Base method to send packet using NetworkInterface. 553 // Base method to send packet using NetworkInterface.
556 bool SendPacket(rtc::Buffer* packet) { 554 bool SendPacket(rtc::Buffer* packet, const rtc::PacketOptions& options) {
557 return DoSendPacket(packet, false); 555 return DoSendPacket(packet, false, options);
558 } 556 }
559 557
560 bool SendRtcp(rtc::Buffer* packet) { 558 bool SendRtcp(rtc::Buffer* packet, const rtc::PacketOptions& options) {
561 return DoSendPacket(packet, true); 559 return DoSendPacket(packet, true, options);
562 } 560 }
563 561
564 int SetOption(NetworkInterface::SocketType type, 562 int SetOption(NetworkInterface::SocketType type,
565 rtc::Socket::Option opt, 563 rtc::Socket::Option opt,
566 int option) { 564 int option) {
567 rtc::CritScope cs(&network_interface_crit_); 565 rtc::CritScope cs(&network_interface_crit_);
568 if (!network_interface_) 566 if (!network_interface_)
569 return -1; 567 return -1;
570 568
571 return network_interface_->SetOption(type, opt, option); 569 return network_interface_->SetOption(type, opt, option);
572 } 570 }
573 571
574 protected: 572 protected:
575 // This method sets DSCP |value| on both RTP and RTCP channels. 573 // This method sets DSCP |value| on both RTP and RTCP channels.
576 int SetDscp(rtc::DiffServCodePoint value) { 574 int SetDscp(rtc::DiffServCodePoint value) {
577 int ret; 575 int ret;
578 ret = SetOption(NetworkInterface::ST_RTP, 576 ret = SetOption(NetworkInterface::ST_RTP,
579 rtc::Socket::OPT_DSCP, 577 rtc::Socket::OPT_DSCP,
580 value); 578 value);
581 if (ret == 0) { 579 if (ret == 0) {
582 ret = SetOption(NetworkInterface::ST_RTCP, 580 ret = SetOption(NetworkInterface::ST_RTCP,
583 rtc::Socket::OPT_DSCP, 581 rtc::Socket::OPT_DSCP,
584 value); 582 value);
585 } 583 }
586 return ret; 584 return ret;
587 } 585 }
588 586
589 private: 587 private:
590 bool DoSendPacket(rtc::Buffer* packet, bool rtcp) { 588 bool DoSendPacket(rtc::Buffer* packet,
589 bool rtcp,
590 const rtc::PacketOptions& options) {
591 rtc::CritScope cs(&network_interface_crit_); 591 rtc::CritScope cs(&network_interface_crit_);
592 if (!network_interface_) 592 if (!network_interface_)
593 return false; 593 return false;
594 594
595 return (!rtcp) ? network_interface_->SendPacket(packet) : 595 return (!rtcp) ? network_interface_->SendPacket(packet, options)
596 network_interface_->SendRtcp(packet); 596 : network_interface_->SendRtcp(packet, options);
597 } 597 }
598 598
599 // |network_interface_| can be accessed from the worker_thread and 599 // |network_interface_| can be accessed from the worker_thread and
600 // from any MediaEngine threads. This critical section is to protect accessing 600 // from any MediaEngine threads. This critical section is to protect accessing
601 // of network_interface_ object. 601 // of network_interface_ object.
602 rtc::CriticalSection network_interface_crit_; 602 rtc::CriticalSection network_interface_crit_;
603 NetworkInterface* network_interface_; 603 NetworkInterface* network_interface_;
604 }; 604 };
605 605
606 enum SendFlags { 606 enum SendFlags {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 // Signal when the media channel is ready to send the stream. Arguments are: 1260 // Signal when the media channel is ready to send the stream. Arguments are:
1261 // writable(bool) 1261 // writable(bool)
1262 sigslot::signal1<bool> SignalReadyToSend; 1262 sigslot::signal1<bool> SignalReadyToSend;
1263 // Signal for notifying that the remote side has closed the DataChannel. 1263 // Signal for notifying that the remote side has closed the DataChannel.
1264 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; 1264 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
1265 }; 1265 };
1266 1266
1267 } // namespace cricket 1267 } // namespace cricket
1268 1268
1269 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ 1269 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698