std::vector<SupportedProfile> profiles;
#if defined(ENABLE_WEBRTC)
- const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
return profiles;
#endif
continue;
}
SupportedProfile profile;
- profile.profile = media::VP8PROFILE_MAIN;
+ profile.profile = media::VP8PROFILE_ANY;
// Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the
// encoder? Sure would be. Too bad it doesn't. So we hard-code some
// reasonable defaults.
return profiles;
}
-void AndroidVideoEncodeAccelerator::Initialize(
+bool AndroidVideoEncodeAccelerator::Initialize(
VideoFrame::Format format,
const gfx::Size& input_visible_size,
media::VideoCodecProfile output_profile,
client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
- RETURN_ON_FAILURE(media::MediaCodecBridge::SupportsSetParameters() &&
- format == VideoFrame::I420 &&
- output_profile == media::VP8PROFILE_MAIN,
- "Unexpected combo: " << format << ", " << output_profile,
- kInvalidArgumentError);
+ if (!(media::MediaCodecBridge::SupportsSetParameters() &&
+ format == VideoFrame::I420 &&
+ output_profile == media::VP8PROFILE_ANY)) {
+ DLOG(ERROR) << "Unexpected combo: " << format << ", " << output_profile;
+ return false;
+ }
last_set_bitrate_ = initial_bitrate;
// Only consider using MediaCodec if it's likely backed by hardware.
- RETURN_ON_FAILURE(!media::VideoCodecBridge::IsKnownUnaccelerated(
- media::kCodecVP8, media::MEDIA_CODEC_ENCODER),
- "No HW support",
- kPlatformFailureError);
+ if (media::VideoCodecBridge::IsKnownUnaccelerated(
+ media::kCodecVP8, media::MEDIA_CODEC_ENCODER)) {
+ DLOG(ERROR) << "No HW support";
+ return false;
+ }
// TODO(fischman): when there is more HW out there with different color-space
// support, this should turn into a negotiation with the codec for supported
IFRAME_INTERVAL,
COLOR_FORMAT_YUV420_SEMIPLANAR));
- RETURN_ON_FAILURE(
- media_codec_,
- "Failed to create/start the codec: " << input_visible_size.ToString(),
- kPlatformFailureError);
-
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&VideoEncodeAccelerator::Client::NotifyInitializeDone,
- client_ptr_factory_->GetWeakPtr()));
+ if (!media_codec_) {
+ DLOG(ERROR) << "Failed to create/start the codec: "
+ << input_visible_size.ToString();
+ return false;
+ }
num_output_buffers_ = media_codec_->GetOutputBuffersCount();
output_buffers_capacity_ = media_codec_->GetOutputBuffersCapacity();
num_output_buffers_,
input_visible_size,
output_buffers_capacity_));
+ return true;
}
void AndroidVideoEncodeAccelerator::MaybeStartIOTimer() {