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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 281 } |
282 | 282 |
283 void VideoEncoderInstance::OnEncoderProbed( | 283 void VideoEncoderInstance::OnEncoderProbed( |
284 int32_t result, | 284 int32_t result, |
285 const std::vector<PP_VideoProfileDescription> profiles) { | 285 const std::vector<PP_VideoProfileDescription> profiles) { |
286 pp::VarDictionary dict; | 286 pp::VarDictionary dict; |
287 dict.Set(pp::Var("name"), pp::Var("supportedProfiles")); | 287 dict.Set(pp::Var("name"), pp::Var("supportedProfiles")); |
288 pp::VarArray js_profiles; | 288 pp::VarArray js_profiles; |
289 dict.Set(pp::Var("profiles"), js_profiles); | 289 dict.Set(pp::Var("profiles"), js_profiles); |
290 | 290 |
291 if (result != PP_OK) { | 291 if (result < 0) { |
292 LogError(result, "Cannot get supported profiles"); | 292 LogError(result, "Cannot get supported profiles"); |
293 PostMessage(dict); | 293 PostMessage(dict); |
294 } | 294 } |
295 | 295 |
296 int32_t idx = 0; | 296 int32_t idx = 0; |
297 for (const PP_VideoProfileDescription& profile : profiles) | 297 for (const PP_VideoProfileDescription& profile : profiles) |
298 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile))); | 298 js_profiles.Set(idx++, pp::Var(VideoProfileToString(profile.profile))); |
299 PostMessage(dict); | 299 PostMessage(dict); |
300 } | 300 } |
301 | 301 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 570 } |
571 | 571 |
572 } // anonymous namespace | 572 } // anonymous namespace |
573 | 573 |
574 namespace pp { | 574 namespace pp { |
575 // Factory function for your specialization of the Module object. | 575 // Factory function for your specialization of the Module object. |
576 Module* CreateModule() { | 576 Module* CreateModule() { |
577 return new VideoEncoderModule(); | 577 return new VideoEncoderModule(); |
578 } | 578 } |
579 } // namespace pp | 579 } // namespace pp |
OLD | NEW |