summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorhclam <hclam@chromium.org>2014-09-10 13:29:01 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-10 20:38:46 +0000
commit42d3637eb8a7a82ac5a3183272224b6c2b5f2249 (patch)
tree6e29ef15ca86a6cd09ea35e5ecbaff759dd76380 /chrome
parent660e22c9b046890cb64947d0942469ea3b5003e2 (diff)
downloadchromium_src-42d3637eb8a7a82ac5a3183272224b6c2b5f2249.zip
chromium_src-42d3637eb8a7a82ac5a3183272224b6c2b5f2249.tar.gz
chromium_src-42d3637eb8a7a82ac5a3183272224b6c2b5f2249.tar.bz2
Cast: Flow hw encoder initialization error to extensions API
cast.streaming API will be notified if there is a hardware initialization error. This way extension can decide whether to restart with a different codec or just fail. Also fixed a small issue that Framer is printing too many messages. BUG=402182 Review URL: https://codereview.chromium.org/555563003 Cr-Commit-Position: refs/heads/master@{#294216}
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/media/cast_session_delegate.cc46
-rw-r--r--chrome/renderer/media/cast_session_delegate.h1
2 files changed, 38 insertions, 9 deletions
diff --git a/chrome/renderer/media/cast_session_delegate.cc b/chrome/renderer/media/cast_session_delegate.cc
index 9e0e10e..c90982c 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);
}
@@ -205,16 +205,44 @@ 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) {
- 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());
+ switch (result) {
+ case media::cast::STATUS_AUDIO_INITIALIZED:
+ audio_frame_input_available_callback_.Run(
+ cast_sender_->audio_frame_input());
+ break;
+ case media::cast::STATUS_VIDEO_INITIALIZED:
+ video_frame_input_available_callback_.Run(
+ cast_sender_->video_frame_input());
+ break;
+ case media::cast::STATUS_INVALID_CAST_ENVIRONMENT:
+ error_callback.Run("Invalid cast environment.");
+ break;
+ case media::cast::STATUS_INVALID_CRYPTO_CONFIGURATION:
+ error_callback.Run("Invalid encryption keys.");
+ break;
+ case media::cast::STATUS_UNSUPPORTED_AUDIO_CODEC:
+ error_callback.Run("Audio codec not supported.");
+ break;
+ case media::cast::STATUS_UNSUPPORTED_VIDEO_CODEC:
+ error_callback.Run("Video codec not supported.");
+ break;
+ case media::cast::STATUS_INVALID_AUDIO_CONFIGURATION:
+ error_callback.Run("Invalid audio configuration.");
+ break;
+ case media::cast::STATUS_INVALID_VIDEO_CONFIGURATION:
+ error_callback.Run("Invalid video configuration.");
+ break;
+ case media::cast::STATUS_HW_VIDEO_ENCODER_NOT_SUPPORTED:
+ error_callback.Run("Hardware video encoder not supported.");
+ break;
+ case media::cast::STATUS_AUDIO_UNINITIALIZED:
+ case media::cast::STATUS_VIDEO_UNINITIALIZED:
+ NOTREACHED() << "Not an error.";
+ break;
}
}
diff --git a/chrome/renderer/media/cast_session_delegate.h b/chrome/renderer/media/cast_session_delegate.h
index c027dff..a89892c 100644
--- a/chrome/renderer/media/cast_session_delegate.h
+++ b/chrome/renderer/media/cast_session_delegate.h
@@ -90,6 +90,7 @@ class CastSessionDelegate {
// If this callback is called with STATUS_INITIALIZED it will report back
// to the sinks that it's ready to accept incoming audio / video frames.
void InitializationResultCB(
+ const ErrorCallback& error_callback,
media::cast::CastInitializationStatus result) const;
private: