OLD | NEW |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 static const MediaContentDescription* GetContentDescription( | 146 static const MediaContentDescription* GetContentDescription( |
147 const ContentInfo* cinfo) { | 147 const ContentInfo* cinfo) { |
148 if (cinfo == NULL) | 148 if (cinfo == NULL) |
149 return NULL; | 149 return NULL; |
150 return static_cast<const MediaContentDescription*>(cinfo->description); | 150 return static_cast<const MediaContentDescription*>(cinfo->description); |
151 } | 151 } |
152 | 152 |
153 BaseChannel::BaseChannel(rtc::Thread* thread, | 153 BaseChannel::BaseChannel(rtc::Thread* thread, |
154 MediaEngineInterface* media_engine, | |
155 MediaChannel* media_channel, BaseSession* session, | 154 MediaChannel* media_channel, BaseSession* session, |
156 const std::string& content_name, bool rtcp) | 155 const std::string& content_name, bool rtcp) |
157 : worker_thread_(thread), | 156 : worker_thread_(thread), |
158 media_engine_(media_engine), | |
159 session_(session), | 157 session_(session), |
160 media_channel_(media_channel), | 158 media_channel_(media_channel), |
161 content_name_(content_name), | 159 content_name_(content_name), |
162 rtcp_(rtcp), | 160 rtcp_(rtcp), |
163 transport_channel_(NULL), | 161 transport_channel_(NULL), |
164 rtcp_transport_channel_(NULL), | 162 rtcp_transport_channel_(NULL), |
165 enabled_(false), | 163 enabled_(false), |
166 writable_(false), | 164 writable_(false), |
167 rtp_ready_to_send_(false), | 165 rtp_ready_to_send_(false), |
168 rtcp_ready_to_send_(false), | 166 rtcp_ready_to_send_(false), |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); | 1286 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); |
1289 } | 1287 } |
1290 } | 1288 } |
1291 | 1289 |
1292 VoiceChannel::VoiceChannel(rtc::Thread* thread, | 1290 VoiceChannel::VoiceChannel(rtc::Thread* thread, |
1293 MediaEngineInterface* media_engine, | 1291 MediaEngineInterface* media_engine, |
1294 VoiceMediaChannel* media_channel, | 1292 VoiceMediaChannel* media_channel, |
1295 BaseSession* session, | 1293 BaseSession* session, |
1296 const std::string& content_name, | 1294 const std::string& content_name, |
1297 bool rtcp) | 1295 bool rtcp) |
1298 : BaseChannel(thread, media_engine, media_channel, session, content_name, | 1296 : BaseChannel(thread, media_channel, session, content_name, |
1299 rtcp), | 1297 rtcp), |
| 1298 media_engine_(media_engine), |
1300 received_media_(false) { | 1299 received_media_(false) { |
1301 } | 1300 } |
1302 | 1301 |
1303 VoiceChannel::~VoiceChannel() { | 1302 VoiceChannel::~VoiceChannel() { |
1304 StopAudioMonitor(); | 1303 StopAudioMonitor(); |
1305 StopMediaMonitor(); | 1304 StopMediaMonitor(); |
1306 // this can't be done in the base class, since it calls a virtual | 1305 // this can't be done in the base class, since it calls a virtual |
1307 DisableMedia_w(); | 1306 DisableMedia_w(); |
1308 Deinit(); | 1307 Deinit(); |
1309 } | 1308 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 } | 1431 } |
1433 | 1432 |
1434 bool VoiceChannel::MuteStream_w(uint32 ssrc, bool mute) { | 1433 bool VoiceChannel::MuteStream_w(uint32 ssrc, bool mute) { |
1435 bool ret = BaseChannel::MuteStream_w(ssrc, mute); | 1434 bool ret = BaseChannel::MuteStream_w(ssrc, mute); |
1436 if (typing_monitor_ && mute) | 1435 if (typing_monitor_ && mute) |
1437 typing_monitor_->OnChannelMuted(); | 1436 typing_monitor_->OnChannelMuted(); |
1438 return ret; | 1437 return ret; |
1439 } | 1438 } |
1440 | 1439 |
1441 int VoiceChannel::GetInputLevel_w() { | 1440 int VoiceChannel::GetInputLevel_w() { |
1442 return media_engine()->GetInputLevel(); | 1441 return media_engine_->GetInputLevel(); |
1443 } | 1442 } |
1444 | 1443 |
1445 int VoiceChannel::GetOutputLevel_w() { | 1444 int VoiceChannel::GetOutputLevel_w() { |
1446 return media_channel()->GetOutputLevel(); | 1445 return media_channel()->GetOutputLevel(); |
1447 } | 1446 } |
1448 | 1447 |
1449 void VoiceChannel::GetActiveStreams_w(AudioInfo::StreamList* actives) { | 1448 void VoiceChannel::GetActiveStreams_w(AudioInfo::StreamList* actives) { |
1450 media_channel()->GetActiveStreams(actives); | 1449 media_channel()->GetActiveStreams(actives); |
1451 } | 1450 } |
1452 | 1451 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 default: | 1677 default: |
1679 break; | 1678 break; |
1680 } | 1679 } |
1681 } | 1680 } |
1682 | 1681 |
1683 void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { | 1682 void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { |
1684 GetSupportedAudioCryptoSuites(ciphers); | 1683 GetSupportedAudioCryptoSuites(ciphers); |
1685 } | 1684 } |
1686 | 1685 |
1687 VideoChannel::VideoChannel(rtc::Thread* thread, | 1686 VideoChannel::VideoChannel(rtc::Thread* thread, |
1688 MediaEngineInterface* media_engine, | |
1689 VideoMediaChannel* media_channel, | 1687 VideoMediaChannel* media_channel, |
1690 BaseSession* session, | 1688 BaseSession* session, |
1691 const std::string& content_name, | 1689 const std::string& content_name, |
1692 bool rtcp) | 1690 bool rtcp) |
1693 : BaseChannel(thread, media_engine, media_channel, session, content_name, | 1691 : BaseChannel(thread, media_channel, session, content_name, |
1694 rtcp), | 1692 rtcp), |
1695 renderer_(NULL), | 1693 renderer_(NULL), |
1696 previous_we_(rtc::WE_CLOSE) { | 1694 previous_we_(rtc::WE_CLOSE) { |
1697 } | 1695 } |
1698 | 1696 |
1699 bool VideoChannel::Init() { | 1697 bool VideoChannel::Init() { |
1700 if (!BaseChannel::Init()) { | 1698 if (!BaseChannel::Init()) { |
1701 return false; | 1699 return false; |
1702 } | 1700 } |
1703 media_channel()->SignalMediaError.connect( | 1701 media_channel()->SignalMediaError.connect( |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 | 2119 |
2122 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { | 2120 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { |
2123 GetSupportedVideoCryptoSuites(ciphers); | 2121 GetSupportedVideoCryptoSuites(ciphers); |
2124 } | 2122 } |
2125 | 2123 |
2126 DataChannel::DataChannel(rtc::Thread* thread, | 2124 DataChannel::DataChannel(rtc::Thread* thread, |
2127 DataMediaChannel* media_channel, | 2125 DataMediaChannel* media_channel, |
2128 BaseSession* session, | 2126 BaseSession* session, |
2129 const std::string& content_name, | 2127 const std::string& content_name, |
2130 bool rtcp) | 2128 bool rtcp) |
2131 // MediaEngine is NULL | 2129 : BaseChannel(thread, media_channel, session, content_name, rtcp), |
2132 : BaseChannel(thread, NULL, media_channel, session, content_name, rtcp), | |
2133 data_channel_type_(cricket::DCT_NONE), | 2130 data_channel_type_(cricket::DCT_NONE), |
2134 ready_to_send_data_(false) { | 2131 ready_to_send_data_(false) { |
2135 } | 2132 } |
2136 | 2133 |
2137 DataChannel::~DataChannel() { | 2134 DataChannel::~DataChannel() { |
2138 StopMediaMonitor(); | 2135 StopMediaMonitor(); |
2139 // this can't be done in the base class, since it calls a virtual | 2136 // this can't be done in the base class, since it calls a virtual |
2140 DisableMedia_w(); | 2137 DisableMedia_w(); |
2141 | 2138 |
2142 Deinit(); | 2139 Deinit(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 return (data_channel_type_ == DCT_RTP); | 2473 return (data_channel_type_ == DCT_RTP); |
2477 } | 2474 } |
2478 | 2475 |
2479 void DataChannel::OnStreamClosedRemotely(uint32 sid) { | 2476 void DataChannel::OnStreamClosedRemotely(uint32 sid) { |
2480 rtc::TypedMessageData<uint32>* message = | 2477 rtc::TypedMessageData<uint32>* message = |
2481 new rtc::TypedMessageData<uint32>(sid); | 2478 new rtc::TypedMessageData<uint32>(sid); |
2482 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2479 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2483 } | 2480 } |
2484 | 2481 |
2485 } // namespace cricket | 2482 } // namespace cricket |
OLD | NEW |