Chromium Code Reviews| 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 3d16c5b8d40e16fd66b3ca26f97bdc94db8fa958..3bf8ae36fa2b55246bb7cf9340032f867d13ed56 100644 |
| --- a/chrome/renderer/media/cast_session_delegate.cc |
| +++ b/chrome/renderer/media/cast_session_delegate.cc |
| @@ -55,7 +55,7 @@ void CastSessionDelegate::StartAudio( |
| cast_sender_->InitializeAudio( |
| config, |
| base::Bind(&CastSessionDelegate::InitializationResultCB, |
| - weak_factory_.GetWeakPtr())); |
| + weak_factory_.GetWeakPtr(), error_callback)); |
| } |
| void CastSessionDelegate::StartVideo( |
| @@ -77,7 +77,7 @@ void CastSessionDelegate::StartVideo( |
| cast_sender_->InitializeVideo( |
| config, |
| base::Bind(&CastSessionDelegate::InitializationResultCB, |
| - weak_factory_.GetWeakPtr()), |
| + weak_factory_.GetWeakPtr(), error_callback), |
| create_vea_cb, |
| create_video_encode_mem_cb); |
| } |
| @@ -203,16 +203,38 @@ void CastSessionDelegate::StatusNotificationCB( |
| } |
| void CastSessionDelegate::InitializationResultCB( |
| + const ErrorCallback& error_callback, |
| media::cast::CastInitializationStatus result) const { |
| DCHECK(cast_sender_); |
| - // TODO(pwestin): handle the error codes. |
| if (result == media::cast::STATUS_AUDIO_INITIALIZED) { |
|
hubbe
2014/09/09 19:11:03
Make this part of the switch() ?
Alpha Left Google
2014/09/09 19:41:18
Done.
|
| audio_frame_input_available_callback_.Run( |
| cast_sender_->audio_frame_input()); |
| } else if (result == media::cast::STATUS_VIDEO_INITIALIZED) { |
| video_frame_input_available_callback_.Run( |
| cast_sender_->video_frame_input()); |
| + } else if (result > media::cast::STATUS_VIDEO_INITIALIZED) { |
| + switch (status) { |
| + case media::cast::STATUS_INVALID_CAST_ENVIRONMENT: |
| + error_callback.Run("Invalid cast environment."); |
|
hubbe
2014/09/09 19:11:03
break?
Alpha Left Google
2014/09/09 19:41:17
Whooooops. Done.
|
| + case media::cast::STATUS_INVALID_CRYPTO_CONFIGURATION: |
| + error_callback.Run("Invalid encryption keys."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_UNSUPPORTED_AUDIO_CODEC: |
| + error_callback.Run("Audio codec not supported."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_UNSUPPORTED_VIDEO_CODEC: |
| + error_callback.Run("Video codec not supported."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_INVALID_AUDIO_CONFIGURATION: |
| + error_callback.Run("Invalid audio configuration."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_INVALID_VIDEO_CONFIGURATION: |
| + error_callback.Run("Invalid video configuration."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_HW_VIDEO_ENCODER_NOT_SUPPORTED: |
| + error_callback.Run("Hardware video encoder not supported."); |
|
hubbe
2014/09/09 19:11:03
break?
|
| + case media::cast::STATUS_AUDIO_UNINITIALIZED: |
| + case media::cast::STATUS_VIDEO_UNINITIALIZED: |
| + case media::cast::STATUS_AUDIO_INITIALIZED: |
| + case media::cast::STATUS_VIDEO_INITIALIZED: |
| + NOTREACHED() << "Not an error."; |
| + } |
| } |
| } |