| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <math.h> | 5 #include <math.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 | 275 |
| 276 void VideoEncoderInstance::OnEncoderProbed( | 276 void VideoEncoderInstance::OnEncoderProbed( |
| 277 int32_t result, | 277 int32_t result, |
| 278 const std::vector<PP_VideoProfileDescription> profiles) { | 278 const std::vector<PP_VideoProfileDescription> profiles) { |
| 279 pp::VarDictionary dict; | 279 pp::VarDictionary dict; |
| 280 dict.Set(pp::Var("name"), pp::Var("supportedProfiles")); | 280 dict.Set(pp::Var("name"), pp::Var("supportedProfiles")); |
| 281 pp::VarArray js_profiles; | 281 pp::VarArray js_profiles; |
| 282 dict.Set(pp::Var("profiles"), js_profiles); | 282 dict.Set(pp::Var("profiles"), js_profiles); |
| 283 | 283 |
| 284 if (result != PP_OK) { | 284 if (result < 0) { |
| 285 LogError(result, "Cannot get supported profiles"); | 285 LogError(result, "Cannot get supported profiles"); |
| 286 PostMessage(dict); | 286 PostMessage(dict); |
| 287 } | 287 } |
| 288 | 288 |
| 289 int32_t idx = 0; | 289 int32_t idx = 0; |
| 290 for (uint32_t i = 0; i < profiles.size(); i++) { | 290 for (uint32_t i = 0; i < profiles.size(); i++) { |
| 291 const PP_VideoProfileDescription& profile = profiles[i]; | 291 const PP_VideoProfileDescription& profile = profiles[i]; |
| 292 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile))); | 292 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile))); |
| 293 } | 293 } |
| 294 PostMessage(dict); | 294 PostMessage(dict); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // anonymous namespace | 565 } // anonymous namespace |
| 566 | 566 |
| 567 namespace pp { | 567 namespace pp { |
| 568 // Factory function for your specialization of the Module object. | 568 // Factory function for your specialization of the Module object. |
| 569 Module* CreateModule() { | 569 Module* CreateModule() { |
| 570 return new VideoEncoderModule(); | 570 return new VideoEncoderModule(); |
| 571 } | 571 } |
| 572 } // namespace pp | 572 } // namespace pp |
| OLD | NEW |