| Index: native_client_sdk/src/examples/api/video_encode/video_encode.cc
|
| diff --git a/ppapi/examples/video_encode/video_encode.cc b/native_client_sdk/src/examples/api/video_encode/video_encode.cc
|
| similarity index 96%
|
| copy from ppapi/examples/video_encode/video_encode.cc
|
| copy to native_client_sdk/src/examples/api/video_encode/video_encode.cc
|
| index 66d141a525648ef1551707440e20909ed560e721..702786c0ed8a16a395a60cd79dda412357d4b4a6 100644
|
| --- a/ppapi/examples/video_encode/video_encode.cc
|
| +++ b/native_client_sdk/src/examples/api/video_encode/video_encode.cc
|
| @@ -150,7 +150,6 @@ class VideoEncoderInstance : public pp::Instance {
|
| void Log(const std::string& message);
|
|
|
| void PostDataMessage(const void* buffer, uint32_t size);
|
| - void PostSignalMessage(const char* name);
|
|
|
| typedef std::map<std::string, PP_VideoProfile> VideoProfileFromStringMap;
|
| VideoProfileFromStringMap profile_from_string_;
|
| @@ -250,12 +249,6 @@ void VideoEncoderInstance::ConfigureTrack() {
|
| frame_size_.height(),
|
| PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE};
|
|
|
| - pp::VarDictionary dict;
|
| - dict.Set(pp::Var("status"), pp::Var("configuring video track"));
|
| - dict.Set(pp::Var("width"), pp::Var(frame_size_.width()));
|
| - dict.Set(pp::Var("height"), pp::Var(frame_size_.height()));
|
| - PostMessage(dict);
|
| -
|
| video_track_.Configure(
|
| attrib_list,
|
| callback_factory_.NewCallback(&VideoEncoderInstance::OnConfiguredTrack));
|
| @@ -294,8 +287,10 @@ void VideoEncoderInstance::OnEncoderProbed(
|
| }
|
|
|
| int32_t idx = 0;
|
| - for (const PP_VideoProfileDescription& profile : profiles)
|
| + for (uint32_t i = 0; i < profiles.size(); i++) {
|
| + const PP_VideoProfileDescription& profile = profiles[i];
|
| js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile)));
|
| + }
|
| PostMessage(dict);
|
| }
|
|
|
| @@ -320,7 +315,7 @@ void VideoEncoderInstance::OnInitializedEncoder(int32_t result) {
|
| }
|
|
|
| is_encoding_ = true;
|
| - PostSignalMessage("started");
|
| + Log("started");
|
|
|
| if (video_encoder_.GetFrameCodedSize(&encoder_size_) != PP_OK) {
|
| LogError(result, "Cannot get encoder coded frame size");
|
| @@ -501,7 +496,7 @@ void VideoEncoderInstance::HandleMessage(const pp::Var& var_message) {
|
| ConfigureTrack();
|
| } else if (command == "stop") {
|
| StopEncode();
|
| - PostSignalMessage("stopped");
|
| + Log("stopped");
|
| } else {
|
| LogToConsole(PP_LOGLEVEL_ERROR, pp::Var("Invalid command!"));
|
| }
|
| @@ -546,23 +541,21 @@ void VideoEncoderInstance::PostDataMessage(const void* buffer, uint32_t size) {
|
| PostMessage(dictionary);
|
| }
|
|
|
| -void VideoEncoderInstance::PostSignalMessage(const char* name) {
|
| - pp::VarDictionary dictionary;
|
| - dictionary.Set(pp::Var("name"), pp::Var(name));
|
| -
|
| - PostMessage(dictionary);
|
| -}
|
| -
|
| void VideoEncoderInstance::LogError(int32_t error, const std::string& message) {
|
| std::string msg("Error: ");
|
| msg.append(pp::Var(error).DebugString());
|
| msg.append(" : ");
|
| msg.append(message);
|
| - LogToConsole(PP_LOGLEVEL_ERROR, pp::Var(msg));
|
| +
|
| + Log(msg);
|
| }
|
|
|
| void VideoEncoderInstance::Log(const std::string& message) {
|
| - LogToConsole(PP_LOGLEVEL_LOG, pp::Var(message));
|
| + pp::VarDictionary dictionary;
|
| + dictionary.Set(pp::Var("name"), pp::Var("log"));
|
| + dictionary.Set(pp::Var("message"), pp::Var(message));
|
| +
|
| + PostMessage(dictionary);
|
| }
|
|
|
| pp::Instance* VideoEncoderModule::CreateInstance(PP_Instance instance) {
|
|
|