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

Side by Side Diff: talk/session/media/channel.cc

Issue 1311533009: - Rename VoiceChannel::MuteStream() -> SetAudioSend() (incl. media channel) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@lj_remove_typingmonitor_files
Patch Set: typo in comment Created 5 years, 3 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
« no previous file with comments | « talk/session/media/channel.h ('k') | talk/session/media/channel_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 tc->SignalReadyToSend.disconnect(this); 315 tc->SignalReadyToSend.disconnect(this);
316 } 316 }
317 317
318 bool BaseChannel::Enable(bool enable) { 318 bool BaseChannel::Enable(bool enable) {
319 worker_thread_->Invoke<void>(Bind( 319 worker_thread_->Invoke<void>(Bind(
320 enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w, 320 enable ? &BaseChannel::EnableMedia_w : &BaseChannel::DisableMedia_w,
321 this)); 321 this));
322 return true; 322 return true;
323 } 323 }
324 324
325 bool BaseChannel::MuteStream(uint32 ssrc, bool mute) {
326 return InvokeOnWorker(Bind(&BaseChannel::MuteStream_w, this, ssrc, mute));
327 }
328
329 bool BaseChannel::IsStreamMuted(uint32 ssrc) {
330 return InvokeOnWorker(Bind(&BaseChannel::IsStreamMuted_w, this, ssrc));
331 }
332
333 bool BaseChannel::AddRecvStream(const StreamParams& sp) { 325 bool BaseChannel::AddRecvStream(const StreamParams& sp) {
334 return InvokeOnWorker(Bind(&BaseChannel::AddRecvStream_w, this, sp)); 326 return InvokeOnWorker(Bind(&BaseChannel::AddRecvStream_w, this, sp));
335 } 327 }
336 328
337 bool BaseChannel::RemoveRecvStream(uint32 ssrc) { 329 bool BaseChannel::RemoveRecvStream(uint32 ssrc) {
338 return InvokeOnWorker(Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc)); 330 return InvokeOnWorker(Bind(&BaseChannel::RemoveRecvStream_w, this, ssrc));
339 } 331 }
340 332
341 bool BaseChannel::AddSendStream(const StreamParams& sp) { 333 bool BaseChannel::AddSendStream(const StreamParams& sp) {
342 return InvokeOnWorker( 334 return InvokeOnWorker(
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 void BaseChannel::DisableMedia_w() { 708 void BaseChannel::DisableMedia_w() {
717 ASSERT(worker_thread_ == rtc::Thread::Current()); 709 ASSERT(worker_thread_ == rtc::Thread::Current());
718 if (!enabled_) 710 if (!enabled_)
719 return; 711 return;
720 712
721 LOG(LS_INFO) << "Channel disabled"; 713 LOG(LS_INFO) << "Channel disabled";
722 enabled_ = false; 714 enabled_ = false;
723 ChangeState(); 715 ChangeState();
724 } 716 }
725 717
726 bool BaseChannel::MuteStream_w(uint32 ssrc, bool mute) {
727 ASSERT(worker_thread_ == rtc::Thread::Current());
728 bool ret = media_channel()->MuteStream(ssrc, mute);
729 if (ret) {
730 if (mute)
731 muted_streams_.insert(ssrc);
732 else
733 muted_streams_.erase(ssrc);
734 }
735 return ret;
736 }
737
738 bool BaseChannel::IsStreamMuted_w(uint32 ssrc) {
739 ASSERT(worker_thread_ == rtc::Thread::Current());
740 return muted_streams_.find(ssrc) != muted_streams_.end();
741 }
742
743 void BaseChannel::ChannelWritable_w() { 718 void BaseChannel::ChannelWritable_w() {
744 ASSERT(worker_thread_ == rtc::Thread::Current()); 719 ASSERT(worker_thread_ == rtc::Thread::Current());
745 if (writable_) 720 if (writable_)
746 return; 721 return;
747 722
748 LOG(LS_INFO) << "Channel socket writable (" 723 LOG(LS_INFO) << "Channel socket writable ("
749 << transport_channel_->content_name() << ", " 724 << transport_channel_->content_name() << ", "
750 << transport_channel_->component() << ")" 725 << transport_channel_->component() << ")"
751 << (was_ever_writable_ ? "" : " for the first time"); 726 << (was_ever_writable_ ? "" : " for the first time");
752 727
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 srtp_filter()->SignalSrtpError.connect( 1257 srtp_filter()->SignalSrtpError.connect(
1283 this, &VoiceChannel::OnSrtpError); 1258 this, &VoiceChannel::OnSrtpError);
1284 return true; 1259 return true;
1285 } 1260 }
1286 1261
1287 bool VoiceChannel::SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) { 1262 bool VoiceChannel::SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) {
1288 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetRemoteRenderer, 1263 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetRemoteRenderer,
1289 media_channel(), ssrc, renderer)); 1264 media_channel(), ssrc, renderer));
1290 } 1265 }
1291 1266
1292 bool VoiceChannel::SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer) { 1267 bool VoiceChannel::SetAudioSend(uint32 ssrc, bool mute,
1293 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetLocalRenderer, 1268 const AudioOptions* options,
1294 media_channel(), ssrc, renderer)); 1269 AudioRenderer* renderer) {
1270 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetAudioSend,
1271 media_channel(), ssrc, mute, options, renderer));
1295 } 1272 }
1296 1273
1297 bool VoiceChannel::SetRingbackTone(const void* buf, int len) { 1274 bool VoiceChannel::SetRingbackTone(const void* buf, int len) {
1298 return InvokeOnWorker(Bind(&VoiceChannel::SetRingbackTone_w, this, buf, len)); 1275 return InvokeOnWorker(Bind(&VoiceChannel::SetRingbackTone_w, this, buf, len));
1299 } 1276 }
1300 1277
1301 // TODO(juberti): Handle early media the right way. We should get an explicit 1278 // TODO(juberti): Handle early media the right way. We should get an explicit
1302 // ringing message telling us to start playing local ringback, which we cancel 1279 // ringing message telling us to start playing local ringback, which we cancel
1303 // if any early media actually arrives. For now, we do the opposite, which is 1280 // if any early media actually arrives. For now, we do the opposite, which is
1304 // to wait 1 second for early media, and start playing local ringback if none 1281 // to wait 1 second for early media, and start playing local ringback if none
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 1530
1554 bool VoiceChannel::InsertDtmf_w(uint32 ssrc, int event, int duration, 1531 bool VoiceChannel::InsertDtmf_w(uint32 ssrc, int event, int duration,
1555 int flags) { 1532 int flags) {
1556 if (!enabled()) { 1533 if (!enabled()) {
1557 return false; 1534 return false;
1558 } 1535 }
1559 1536
1560 return media_channel()->InsertDtmf(ssrc, event, duration, flags); 1537 return media_channel()->InsertDtmf(ssrc, event, duration, flags);
1561 } 1538 }
1562 1539
1563 bool VoiceChannel::SetChannelOptions(const AudioOptions& options) {
1564 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOptions,
1565 media_channel(), options));
1566 }
1567
1568 void VoiceChannel::OnMessage(rtc::Message *pmsg) { 1540 void VoiceChannel::OnMessage(rtc::Message *pmsg) {
1569 switch (pmsg->message_id) { 1541 switch (pmsg->message_id) {
1570 case MSG_EARLYMEDIATIMEOUT: 1542 case MSG_EARLYMEDIATIMEOUT:
1571 HandleEarlyMediaTimeout(); 1543 HandleEarlyMediaTimeout();
1572 break; 1544 break;
1573 case MSG_CHANNEL_ERROR: { 1545 case MSG_CHANNEL_ERROR: {
1574 VoiceChannelErrorMessageData* data = 1546 VoiceChannelErrorMessageData* data =
1575 static_cast<VoiceChannelErrorMessageData*>(pmsg->pdata); 1547 static_cast<VoiceChannelErrorMessageData*>(pmsg->pdata);
1576 SignalMediaError(this, data->ssrc, data->error); 1548 SignalMediaError(this, data->ssrc, data->error);
1577 delete data; 1549 delete data;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 &VideoMediaChannel::SendIntraFrame, media_channel())); 1700 &VideoMediaChannel::SendIntraFrame, media_channel()));
1729 return true; 1701 return true;
1730 } 1702 }
1731 1703
1732 bool VideoChannel::RequestIntraFrame() { 1704 bool VideoChannel::RequestIntraFrame() {
1733 worker_thread()->Invoke<void>(Bind( 1705 worker_thread()->Invoke<void>(Bind(
1734 &VideoMediaChannel::RequestIntraFrame, media_channel())); 1706 &VideoMediaChannel::RequestIntraFrame, media_channel()));
1735 return true; 1707 return true;
1736 } 1708 }
1737 1709
1710 bool VideoChannel::SetVideoSend(uint32 ssrc, bool mute,
1711 const VideoOptions* options) {
1712 return InvokeOnWorker(Bind(&VideoMediaChannel::SetVideoSend,
1713 media_channel(), ssrc, mute, options));
1714 }
1715
1738 void VideoChannel::ChangeState() { 1716 void VideoChannel::ChangeState() {
1739 // Render incoming data if we're the active call, and we have the local 1717 // Render incoming data if we're the active call, and we have the local
1740 // content. We receive data on the default channel and multiplexed streams. 1718 // content. We receive data on the default channel and multiplexed streams.
1741 bool recv = IsReadyToReceive(); 1719 bool recv = IsReadyToReceive();
1742 if (!media_channel()->SetRender(recv)) { 1720 if (!media_channel()->SetRender(recv)) {
1743 LOG(LS_ERROR) << "Failed to SetRender on video channel"; 1721 LOG(LS_ERROR) << "Failed to SetRender on video channel";
1744 // TODO(gangji): Report error back to server. 1722 // TODO(gangji): Report error back to server.
1745 } 1723 }
1746 1724
1747 // Send outgoing data if we're the active call, we have the remote content, 1725 // Send outgoing data if we're the active call, we have the remote content,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 data->fps = VideoFormat::IntervalToFps(video_format->interval); 1923 data->fps = VideoFormat::IntervalToFps(video_format->interval);
1946 data->screencast_max_pixels = capturer->screencast_max_pixels(); 1924 data->screencast_max_pixels = capturer->screencast_max_pixels();
1947 } 1925 }
1948 1926
1949 void VideoChannel::OnScreencastWindowEvent_s(uint32 ssrc, 1927 void VideoChannel::OnScreencastWindowEvent_s(uint32 ssrc,
1950 rtc::WindowEvent we) { 1928 rtc::WindowEvent we) {
1951 ASSERT(signaling_thread() == rtc::Thread::Current()); 1929 ASSERT(signaling_thread() == rtc::Thread::Current());
1952 SignalScreencastWindowEvent(ssrc, we); 1930 SignalScreencastWindowEvent(ssrc, we);
1953 } 1931 }
1954 1932
1955 bool VideoChannel::SetChannelOptions(const VideoOptions &options) {
1956 return InvokeOnWorker(Bind(&VideoMediaChannel::SetOptions,
1957 media_channel(), options));
1958 }
1959
1960 void VideoChannel::OnMessage(rtc::Message *pmsg) { 1933 void VideoChannel::OnMessage(rtc::Message *pmsg) {
1961 switch (pmsg->message_id) { 1934 switch (pmsg->message_id) {
1962 case MSG_SCREENCASTWINDOWEVENT: { 1935 case MSG_SCREENCASTWINDOWEVENT: {
1963 const ScreencastEventMessageData* data = 1936 const ScreencastEventMessageData* data =
1964 static_cast<ScreencastEventMessageData*>(pmsg->pdata); 1937 static_cast<ScreencastEventMessageData*>(pmsg->pdata);
1965 OnScreencastWindowEvent_s(data->ssrc, data->event); 1938 OnScreencastWindowEvent_s(data->ssrc, data->event);
1966 delete data; 1939 delete data;
1967 break; 1940 break;
1968 } 1941 }
1969 case MSG_CHANNEL_ERROR: { 1942 case MSG_CHANNEL_ERROR: {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 ASSERT(mode == SrtpFilter::UNPROTECT); 2032 ASSERT(mode == SrtpFilter::UNPROTECT);
2060 // TODO(gangji): Turn on the signaling of replay error once we have 2033 // TODO(gangji): Turn on the signaling of replay error once we have
2061 // switched to the new mechanism for doing video retransmissions. 2034 // switched to the new mechanism for doing video retransmissions.
2062 // OnVideoChannelError(ssrc, VideoMediaChannel::ERROR_PLAY_SRTP_REPLAY); 2035 // OnVideoChannelError(ssrc, VideoMediaChannel::ERROR_PLAY_SRTP_REPLAY);
2063 break; 2036 break;
2064 default: 2037 default:
2065 break; 2038 break;
2066 } 2039 }
2067 } 2040 }
2068 2041
2069
2070 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { 2042 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const {
2071 GetSupportedVideoCryptoSuites(ciphers); 2043 GetSupportedVideoCryptoSuites(ciphers);
2072 } 2044 }
2073 2045
2074 DataChannel::DataChannel(rtc::Thread* thread, 2046 DataChannel::DataChannel(rtc::Thread* thread,
2075 DataMediaChannel* media_channel, 2047 DataMediaChannel* media_channel,
2076 BaseSession* session, 2048 BaseSession* session,
2077 const std::string& content_name, 2049 const std::string& content_name,
2078 bool rtcp) 2050 bool rtcp)
2079 : BaseChannel(thread, media_channel, session, content_name, rtcp), 2051 : BaseChannel(thread, media_channel, session, content_name, rtcp),
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 return (data_channel_type_ == DCT_RTP); 2379 return (data_channel_type_ == DCT_RTP);
2408 } 2380 }
2409 2381
2410 void DataChannel::OnStreamClosedRemotely(uint32 sid) { 2382 void DataChannel::OnStreamClosedRemotely(uint32 sid) {
2411 rtc::TypedMessageData<uint32>* message = 2383 rtc::TypedMessageData<uint32>* message =
2412 new rtc::TypedMessageData<uint32>(sid); 2384 new rtc::TypedMessageData<uint32>(sid);
2413 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); 2385 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message);
2414 } 2386 }
2415 2387
2416 } // namespace cricket 2388 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/session/media/channel.h ('k') | talk/session/media/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698