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

Side by Side Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 1027363002: Change EmeInitDataType to be an enum class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « components/cdm/renderer/widevine_key_systems.cc ('k') | media/base/eme_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/media/cdm/browser_cdm_manager.h" 5 #include "content/browser/media/cdm/browser_cdm_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 scoped_ptr<NewSessionPromise> promise( 340 scoped_ptr<NewSessionPromise> promise(
341 new NewSessionPromise(this, render_frame_id, cdm_id, promise_id)); 341 new NewSessionPromise(this, render_frame_id, cdm_id, promise_id));
342 342
343 if (init_data.size() > kMaxInitDataLength) { 343 if (init_data.size() > kMaxInitDataLength) {
344 LOG(WARNING) << "InitData for ID: " << cdm_id 344 LOG(WARNING) << "InitData for ID: " << cdm_id
345 << " too long: " << init_data.size(); 345 << " too long: " << init_data.size();
346 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, "Init data too long."); 346 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, "Init data too long.");
347 return; 347 return;
348 } 348 }
349 349
350 media::EmeInitDataType eme_init_data_type = media::EME_INIT_DATA_TYPE_NONE; 350 media::EmeInitDataType eme_init_data_type;
351 switch (init_data_type) { 351 switch (init_data_type) {
352 case INIT_DATA_TYPE_WEBM: 352 case INIT_DATA_TYPE_WEBM:
353 eme_init_data_type = media::EME_INIT_DATA_TYPE_WEBM; 353 eme_init_data_type = media::EmeInitDataType::WEBM;
354 break; 354 break;
355 #if defined(USE_PROPRIETARY_CODECS) 355 #if defined(USE_PROPRIETARY_CODECS)
356 case INIT_DATA_TYPE_CENC: 356 case INIT_DATA_TYPE_CENC:
357 eme_init_data_type = media::EME_INIT_DATA_TYPE_CENC; 357 eme_init_data_type = media::EmeInitDataType::CENC;
358 break; 358 break;
359 #endif 359 #endif
360 default: 360 default:
361 NOTREACHED(); 361 NOTREACHED();
362 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, 362 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0,
363 "Invalid init data type."); 363 "Invalid init data type.");
364 return; 364 return;
365 } 365 }
366 366
367 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); 367 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 if (!cdm) { 553 if (!cdm) {
554 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); 554 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found.");
555 return; 555 return;
556 } 556 }
557 557
558 // TODO(ddorwin): Move this conversion to MediaDrmBridge when fixing 558 // TODO(ddorwin): Move this conversion to MediaDrmBridge when fixing
559 // crbug.com/417440. 559 // crbug.com/417440.
560 // "audio"/"video" does not matter, so use "video". 560 // "audio"/"video" does not matter, so use "video".
561 std::string init_data_type_string; 561 std::string init_data_type_string;
562 switch (init_data_type) { 562 switch (init_data_type) {
563 case media::EME_INIT_DATA_TYPE_WEBM: 563 case media::EmeInitDataType::WEBM:
564 init_data_type_string = "video/webm"; 564 init_data_type_string = "video/webm";
565 break; 565 break;
566 #if defined(USE_PROPRIETARY_CODECS) 566 #if defined(USE_PROPRIETARY_CODECS)
567 case media::EME_INIT_DATA_TYPE_CENC: 567 case media::EmeInitDataType::CENC:
568 init_data_type_string = "video/mp4"; 568 init_data_type_string = "video/mp4";
569 break; 569 break;
570 #endif 570 #endif
571 default: 571 default:
572 NOTREACHED(); 572 NOTREACHED();
573 } 573 }
574 574
575 // Only the temporary session type is supported in browser CDM path. 575 // Only the temporary session type is supported in browser CDM path.
576 // TODO(xhwang): Add SessionType support if needed. 576 // TODO(xhwang): Add SessionType support if needed.
577 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION, 577 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION,
578 init_data_type_string, &init_data[0], 578 init_data_type_string, &init_data[0],
579 init_data.size(), promise.Pass()); 579 init_data.size(), promise.Pass());
580 } 580 }
581 581
582 } // namespace content 582 } // namespace content
OLDNEW
« no previous file with comments | « components/cdm/renderer/widevine_key_systems.cc ('k') | media/base/eme_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698