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

Unified Diff: chrome/renderer/media/cast_session_delegate.cc

Issue 938903003: Cast: Javascript bindings for cast receiver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cast_receiver_session
Patch Set: comments addressed Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/renderer/media/cast_udp_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/media/cast_session_delegate.cc
diff --git a/chrome/renderer/media/cast_session_delegate.cc b/chrome/renderer/media/cast_session_delegate.cc
index 6a0da851835b11cef2b727f2b83222923474accf..2b073867c1cb192265c23ae92edb54fe92d0a637 100644
--- a/chrome/renderer/media/cast_session_delegate.cc
+++ b/chrome/renderer/media/cast_session_delegate.cc
@@ -45,7 +45,8 @@ CastSessionDelegateBase::~CastSessionDelegateBase() {
void CastSessionDelegateBase::StartUDP(
const net::IPEndPoint& local_endpoint,
const net::IPEndPoint& remote_endpoint,
- scoped_ptr<base::DictionaryValue> options) {
+ scoped_ptr<base::DictionaryValue> options,
+ const ErrorCallback& error_callback) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
// CastSender uses the renderer's IO thread as the main thread. This reduces
@@ -66,15 +67,30 @@ void CastSessionDelegateBase::StartUDP(
base::Bind(&CastSessionDelegateBase::ReceivePacket,
base::Unretained(this)),
base::Bind(&CastSessionDelegateBase::StatusNotificationCB,
- base::Unretained(this)),
+ base::Unretained(this), error_callback),
base::Bind(&CastSessionDelegateBase::LogRawEvents,
base::Unretained(this))));
}
void CastSessionDelegateBase::StatusNotificationCB(
- media::cast::CastTransportStatus unused_status) {
+ const ErrorCallback& error_callback,
+ media::cast::CastTransportStatus status) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
- // TODO(hubbe): Call javascript UDPTransport error function.
+ std::string error_message;
+
+ switch (status) {
+ case media::cast::TRANSPORT_AUDIO_UNINITIALIZED:
+ case media::cast::TRANSPORT_VIDEO_UNINITIALIZED:
+ case media::cast::TRANSPORT_AUDIO_INITIALIZED:
+ case media::cast::TRANSPORT_VIDEO_INITIALIZED:
+ return; // Not errors, do nothing.
+ case media::cast::TRANSPORT_INVALID_CRYPTO_CONFIG:
+ error_callback.Run("Invalid encrypt/decrypt configuration.");
+ break;
+ case media::cast::TRANSPORT_SOCKET_ERROR:
+ error_callback.Run("Socket error.");
+ break;
+ }
}
CastSessionDelegate::CastSessionDelegate()
@@ -132,11 +148,13 @@ void CastSessionDelegate::StartVideo(
void CastSessionDelegate::StartUDP(
const net::IPEndPoint& local_endpoint,
const net::IPEndPoint& remote_endpoint,
- scoped_ptr<base::DictionaryValue> options) {
+ scoped_ptr<base::DictionaryValue> options,
+ const ErrorCallback& error_callback) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
CastSessionDelegateBase::StartUDP(local_endpoint,
remote_endpoint,
- options.Pass());
+ options.Pass(),
+ error_callback);
event_subscribers_.reset(
new media::cast::RawEventSubscriberBundle(cast_environment_));
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/renderer/media/cast_udp_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698