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

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

Issue 1362913004: Remove unused SignalMediaError and infrastructure. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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
« no previous file with comments | « no previous file | talk/media/base/mediachannel.h » ('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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 : ssrc(ssrc), event_code(event_code), duration(duration), flags(flags) { 233 : ssrc(ssrc), event_code(event_code), duration(duration), flags(flags) {
234 } 234 }
235 uint32 ssrc; 235 uint32 ssrc;
236 int event_code; 236 int event_code;
237 int duration; 237 int duration;
238 int flags; 238 int flags;
239 }; 239 };
240 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine, 240 explicit FakeVoiceMediaChannel(FakeVoiceEngine* engine,
241 const AudioOptions& options) 241 const AudioOptions& options)
242 : engine_(engine), 242 : engine_(engine),
243 fail_set_send_(false),
244 time_since_last_typing_(-1) { 243 time_since_last_typing_(-1) {
245 output_scalings_[0] = OutputScaling(); // For default channel. 244 output_scalings_[0] = OutputScaling(); // For default channel.
246 SetOptions(options); 245 SetOptions(options);
247 } 246 }
248 ~FakeVoiceMediaChannel(); 247 ~FakeVoiceMediaChannel();
249 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; } 248 const std::vector<AudioCodec>& recv_codecs() const { return recv_codecs_; }
250 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; } 249 const std::vector<AudioCodec>& send_codecs() const { return send_codecs_; }
251 const std::vector<AudioCodec>& codecs() const { return send_codecs(); } 250 const std::vector<AudioCodec>& codecs() const { return send_codecs(); }
252 const std::vector<DtmfInfo>& dtmf_info_queue() const { 251 const std::vector<DtmfInfo>& dtmf_info_queue() const {
253 return dtmf_info_queue_; 252 return dtmf_info_queue_;
254 } 253 }
255 const AudioOptions& options() const { return options_; } 254 const AudioOptions& options() const { return options_; }
256 255
257 virtual bool SetSendParameters(const AudioSendParameters& params) { 256 virtual bool SetSendParameters(const AudioSendParameters& params) {
258 return (SetSendCodecs(params.codecs) && 257 return (SetSendCodecs(params.codecs) &&
259 SetSendRtpHeaderExtensions(params.extensions) && 258 SetSendRtpHeaderExtensions(params.extensions) &&
260 SetMaxSendBandwidth(params.max_bandwidth_bps) && 259 SetMaxSendBandwidth(params.max_bandwidth_bps) &&
261 SetOptions(params.options)); 260 SetOptions(params.options));
262 } 261 }
263 262
264 virtual bool SetRecvParameters(const AudioRecvParameters& params) { 263 virtual bool SetRecvParameters(const AudioRecvParameters& params) {
265 return (SetRecvCodecs(params.codecs) && 264 return (SetRecvCodecs(params.codecs) &&
266 SetRecvRtpHeaderExtensions(params.extensions)); 265 SetRecvRtpHeaderExtensions(params.extensions));
267 } 266 }
268 virtual bool SetPlayout(bool playout) { 267 virtual bool SetPlayout(bool playout) {
269 set_playout(playout); 268 set_playout(playout);
270 return true; 269 return true;
271 } 270 }
272 virtual bool SetSend(SendFlags flag) { 271 virtual bool SetSend(SendFlags flag) {
273 if (fail_set_send_) {
274 return false;
275 }
276 return set_sending(flag != SEND_NOTHING); 272 return set_sending(flag != SEND_NOTHING);
277 } 273 }
278 virtual bool SetAudioSend(uint32 ssrc, bool enable, 274 virtual bool SetAudioSend(uint32 ssrc, bool enable,
279 const AudioOptions* options, 275 const AudioOptions* options,
280 AudioRenderer* renderer) { 276 AudioRenderer* renderer) {
281 if (!SetLocalRenderer(ssrc, renderer)) { 277 if (!SetLocalRenderer(ssrc, renderer)) {
282 return false; 278 return false;
283 } 279 }
284 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) { 280 if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, !enable)) {
285 return false; 281 return false;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 359 }
364 bool GetOutputScaling(uint32 ssrc, double* left, double* right) { 360 bool GetOutputScaling(uint32 ssrc, double* left, double* right) {
365 if (output_scalings_.find(ssrc) == output_scalings_.end()) 361 if (output_scalings_.find(ssrc) == output_scalings_.end())
366 return false; 362 return false;
367 *left = output_scalings_[ssrc].left; 363 *left = output_scalings_[ssrc].left;
368 *right = output_scalings_[ssrc].right; 364 *right = output_scalings_[ssrc].right;
369 return true; 365 return true;
370 } 366 }
371 367
372 virtual bool GetStats(VoiceMediaInfo* info) { return false; } 368 virtual bool GetStats(VoiceMediaInfo* info) { return false; }
373 virtual void GetLastMediaError(uint32* ssrc,
374 VoiceMediaChannel::Error* error) {
375 *ssrc = 0;
376 *error = fail_set_send_ ? VoiceMediaChannel::ERROR_REC_DEVICE_OPEN_FAILED
377 : VoiceMediaChannel::ERROR_NONE;
378 }
379
380 void set_fail_set_send(bool fail) { fail_set_send_ = fail; }
381 void TriggerError(uint32 ssrc, VoiceMediaChannel::Error error) {
382 VoiceMediaChannel::SignalMediaError(ssrc, error);
383 }
384 369
385 private: 370 private:
386 struct OutputScaling { 371 struct OutputScaling {
387 OutputScaling() : left(1.0), right(1.0) {} 372 OutputScaling() : left(1.0), right(1.0) {}
388 double left, right; 373 double left, right;
389 }; 374 };
390 375
391 class VoiceChannelAudioSink : public AudioRenderer::Sink { 376 class VoiceChannelAudioSink : public AudioRenderer::Sink {
392 public: 377 public:
393 explicit VoiceChannelAudioSink(AudioRenderer* renderer) 378 explicit VoiceChannelAudioSink(AudioRenderer* renderer)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 436 }
452 } 437 }
453 return true; 438 return true;
454 } 439 }
455 440
456 FakeVoiceEngine* engine_; 441 FakeVoiceEngine* engine_;
457 std::vector<AudioCodec> recv_codecs_; 442 std::vector<AudioCodec> recv_codecs_;
458 std::vector<AudioCodec> send_codecs_; 443 std::vector<AudioCodec> send_codecs_;
459 std::map<uint32, OutputScaling> output_scalings_; 444 std::map<uint32, OutputScaling> output_scalings_;
460 std::vector<DtmfInfo> dtmf_info_queue_; 445 std::vector<DtmfInfo> dtmf_info_queue_;
461 bool fail_set_send_;
462 int time_since_last_typing_; 446 int time_since_last_typing_;
463 AudioOptions options_; 447 AudioOptions options_;
464 std::map<uint32, VoiceChannelAudioSink*> local_renderers_; 448 std::map<uint32, VoiceChannelAudioSink*> local_renderers_;
465 std::map<uint32, AudioRenderer*> remote_renderers_; 449 std::map<uint32, AudioRenderer*> remote_renderers_;
466 }; 450 };
467 451
468 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo. 452 // A helper function to compare the FakeVoiceMediaChannel::DtmfInfo.
469 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info, 453 inline bool CompareDtmfInfo(const FakeVoiceMediaChannel::DtmfInfo& info,
470 uint32 ssrc, int event_code, int duration, 454 uint32 ssrc, int event_code, int duration,
471 int flags) { 455 int flags) {
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 1003
1020 private: 1004 private:
1021 std::vector<FakeDataMediaChannel*> channels_; 1005 std::vector<FakeDataMediaChannel*> channels_;
1022 std::vector<DataCodec> data_codecs_; 1006 std::vector<DataCodec> data_codecs_;
1023 DataChannelType last_channel_type_; 1007 DataChannelType last_channel_type_;
1024 }; 1008 };
1025 1009
1026 } // namespace cricket 1010 } // namespace cricket
1027 1011
1028 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ 1012 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | talk/media/base/mediachannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698