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

Unified Diff: media/cast/sender/external_video_encoder.cc

Issue 555563003: Cast: Flow hw encoder initialization error to extensions API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compile Created 6 years, 3 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 | « media/cast/sender/external_video_encoder.h ('k') | media/cast/sender/external_video_encoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/external_video_encoder.cc
diff --git a/media/cast/sender/external_video_encoder.cc b/media/cast/sender/external_video_encoder.cc
index 9e9bda1e4a3f49caa3a49f6f30d09a363dc8e2a2..5aca424d4715360dcc1e86dd449bc9be82addc85 100644
--- a/media/cast/sender/external_video_encoder.cc
+++ b/media/cast/sender/external_video_encoder.cc
@@ -114,7 +114,11 @@ class LocalVideoEncodeAcceleratorClient
UMA_HISTOGRAM_BOOLEAN("Cast.Sender.VideoEncodeAcceleratorInitializeSuccess",
result);
if (!result) {
- NotifyError(VideoEncodeAccelerator::kInvalidArgumentError);
+ cast_environment_->PostTask(
+ CastEnvironment::MAIN,
+ FROM_HERE,
+ base::Bind(&ExternalVideoEncoder::EncoderInitialized, weak_owner_,
+ false));
return;
}
@@ -342,7 +346,8 @@ class LocalVideoEncodeAcceleratorClient
cast_environment_->PostTask(
CastEnvironment::MAIN,
FROM_HERE,
- base::Bind(&ExternalVideoEncoder::EncoderInitialized, weak_owner_));
+ base::Bind(&ExternalVideoEncoder::EncoderInitialized, weak_owner_,
+ true));
}
static void DestroyVideoEncodeAcceleratorOnEncoderThread(
@@ -379,12 +384,14 @@ class LocalVideoEncodeAcceleratorClient
ExternalVideoEncoder::ExternalVideoEncoder(
scoped_refptr<CastEnvironment> cast_environment,
const VideoSenderConfig& video_config,
+ const CastInitializationCallback& initialization_cb,
const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb)
: video_config_(video_config),
cast_environment_(cast_environment),
encoder_active_(false),
key_frame_requested_(false),
+ initialization_cb_(initialization_cb),
weak_factory_(this) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
@@ -399,9 +406,14 @@ ExternalVideoEncoder::ExternalVideoEncoder(
ExternalVideoEncoder::~ExternalVideoEncoder() {
}
-void ExternalVideoEncoder::EncoderInitialized() {
+void ExternalVideoEncoder::EncoderInitialized(bool success) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- encoder_active_ = true;
+ encoder_active_ = success;
+ DCHECK(!initialization_cb_.is_null());
+ initialization_cb_.Run(
+ success ?
+ STATUS_VIDEO_INITIALIZED : STATUS_HW_VIDEO_ENCODER_NOT_SUPPORTED);
+ initialization_cb_.Reset();
}
void ExternalVideoEncoder::EncoderError() {
« no previous file with comments | « media/cast/sender/external_video_encoder.h ('k') | media/cast/sender/external_video_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698