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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 10843031: Piping for audio decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small refactoring Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "jingle/glue/thread_wrapper.h" 22 #include "jingle/glue/thread_wrapper.h"
23 #include "media/base/media.h" 23 #include "media/base/media.h"
24 #include "net/socket/ssl_server_socket.h" 24 #include "net/socket/ssl_server_socket.h"
25 #include "ppapi/cpp/completion_callback.h" 25 #include "ppapi/cpp/completion_callback.h"
26 #include "ppapi/cpp/input_event.h" 26 #include "ppapi/cpp/input_event.h"
27 #include "ppapi/cpp/mouse_cursor.h" 27 #include "ppapi/cpp/mouse_cursor.h"
28 #include "ppapi/cpp/rect.h" 28 #include "ppapi/cpp/rect.h"
29 #include "remoting/base/constants.h" 29 #include "remoting/base/constants.h"
30 #include "remoting/base/util.h" 30 #include "remoting/base/util.h"
31 #include "remoting/client/audio_decode_scheduler.h"
31 #include "remoting/client/client_config.h" 32 #include "remoting/client/client_config.h"
32 #include "remoting/client/chromoting_client.h" 33 #include "remoting/client/chromoting_client.h"
33 #include "remoting/client/frame_consumer_proxy.h" 34 #include "remoting/client/frame_consumer_proxy.h"
34 #include "remoting/client/plugin/pepper_audio_player.h" 35 #include "remoting/client/plugin/pepper_audio_player.h"
35 #include "remoting/client/plugin/pepper_input_handler.h" 36 #include "remoting/client/plugin/pepper_input_handler.h"
36 #include "remoting/client/plugin/pepper_port_allocator.h" 37 #include "remoting/client/plugin/pepper_port_allocator.h"
37 #include "remoting/client/plugin/pepper_view.h" 38 #include "remoting/client/plugin/pepper_view.h"
38 #include "remoting/client/plugin/pepper_xmpp_proxy.h" 39 #include "remoting/client/plugin/pepper_xmpp_proxy.h"
39 #include "remoting/client/rectangle_update_decoder.h" 40 #include "remoting/client/rectangle_update_decoder.h"
40 #include "remoting/protocol/connection_to_host.h" 41 #include "remoting/protocol/connection_to_host.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 464 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
464 PostChromotingMessage("onFirstFrameReceived", data.Pass()); 465 PostChromotingMessage("onFirstFrameReceived", data.Pass());
465 } 466 }
466 467
467 void ChromotingInstance::Connect(const ClientConfig& config) { 468 void ChromotingInstance::Connect(const ClientConfig& config) {
468 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 469 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
469 470
470 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); 471 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread();
471 472
472 host_connection_.reset(new protocol::ConnectionToHost(true)); 473 host_connection_.reset(new protocol::ConnectionToHost(true));
473 audio_player_.reset(new PepperAudioPlayer(this)); 474 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this));
475 audio_decode_scheduler_.reset(new AudioDecodeScheduler(
Sergey Ulanov 2012/08/02 20:32:48 Do we really need to create this object here? Can
kxing 2012/08/03 14:51:47 Done.
476 context_.main_task_runner(),
477 context_.audio_decode_task_runner(),
478 audio_player.Pass()));
474 client_.reset(new ChromotingClient(config, context_.main_task_runner(), 479 client_.reset(new ChromotingClient(config, context_.main_task_runner(),
475 host_connection_.get(), this, 480 host_connection_.get(), this,
476 rectangle_decoder_.get(), 481 rectangle_decoder_.get(),
477 audio_player_.get())); 482 audio_decode_scheduler_.get()));
Sergey Ulanov 2012/08/02 20:32:48 Please modify ChromotingClient to take ownership o
kxing 2012/08/03 14:51:47 Done.
478 483
479 // Construct the input pipeline 484 // Construct the input pipeline
480 mouse_input_filter_.reset( 485 mouse_input_filter_.reset(
481 new protocol::MouseInputFilter(host_connection_->input_stub())); 486 new protocol::MouseInputFilter(host_connection_->input_stub()));
482 mouse_input_filter_->set_input_size(view_->get_view_size_dips()); 487 mouse_input_filter_->set_input_size(view_->get_view_size_dips());
483 input_tracker_.reset( 488 input_tracker_.reset(
484 new protocol::InputEventTracker(mouse_input_filter_.get())); 489 new protocol::InputEventTracker(mouse_input_filter_.get()));
485 490
486 #if defined(OS_MACOSX) 491 #if defined(OS_MACOSX)
487 // On Mac we need an extra filter to inject missing keyup events. 492 // On Mac we need an extra filter to inject missing keyup events.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 base::WaitableEvent done_event(true, false); 534 base::WaitableEvent done_event(true, false);
530 client_->Stop(base::Bind(&base::WaitableEvent::Signal, 535 client_->Stop(base::Bind(&base::WaitableEvent::Signal,
531 base::Unretained(&done_event))); 536 base::Unretained(&done_event)));
532 done_event.Wait(); 537 done_event.Wait();
533 client_.reset(); 538 client_.reset();
534 } 539 }
535 540
536 input_handler_.reset(); 541 input_handler_.reset();
537 input_tracker_.reset(); 542 input_tracker_.reset();
538 mouse_input_filter_.reset(); 543 mouse_input_filter_.reset();
539 audio_player_.reset(); 544 audio_decode_scheduler_.reset();
540 host_connection_.reset(); 545 host_connection_.reset();
541 } 546 }
542 547
543 void ChromotingInstance::OnIncomingIq(const std::string& iq) { 548 void ChromotingInstance::OnIncomingIq(const std::string& iq) {
544 xmpp_proxy_->OnIq(iq); 549 xmpp_proxy_->OnIq(iq);
545 } 550 }
546 551
547 void ChromotingInstance::ReleaseAllKeys() { 552 void ChromotingInstance::ReleaseAllKeys() {
548 if (IsConnected()) 553 if (IsConnected())
549 input_tracker_->ReleaseAll(); 554 input_tracker_->ReleaseAll();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 PostChromotingMessage("logDebugMessage", data.Pass()); 752 PostChromotingMessage("logDebugMessage", data.Pass());
748 g_logging_to_plugin = false; 753 g_logging_to_plugin = false;
749 } 754 }
750 755
751 bool ChromotingInstance::IsConnected() { 756 bool ChromotingInstance::IsConnected() {
752 return host_connection_.get() && 757 return host_connection_.get() &&
753 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 758 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
754 } 759 }
755 760
756 } // namespace remoting 761 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698