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

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: 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
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 scoped_ptr<NewSessionPromise> promise( 339 scoped_ptr<NewSessionPromise> promise(
340 new NewSessionPromise(this, render_frame_id, cdm_id, promise_id)); 340 new NewSessionPromise(this, render_frame_id, cdm_id, promise_id));
341 341
342 if (init_data.size() > kMaxInitDataLength) { 342 if (init_data.size() > kMaxInitDataLength) {
343 LOG(WARNING) << "InitData for ID: " << cdm_id 343 LOG(WARNING) << "InitData for ID: " << cdm_id
344 << " too long: " << init_data.size(); 344 << " too long: " << init_data.size();
345 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, "Init data too long."); 345 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, "Init data too long.");
346 return; 346 return;
347 } 347 }
348 348
349 media::EmeInitDataType eme_init_data_type = media::EME_INIT_DATA_TYPE_NONE; 349 media::EmeInitDataType eme_init_data_type = media::EmeInitDataType::NONE;
sandersd (OOO until July 31) 2015/03/23 21:27:30 I'm okay with not initializing to a value here, it
jrummell 2015/03/25 21:44:24 Done. We'll see if any compiler complains.
sandersd (OOO until July 31) 2015/03/25 22:01:28 If you're leaving UNKNOWN in then it's fine to ini
350 switch (init_data_type) { 350 switch (init_data_type) {
351 case INIT_DATA_TYPE_WEBM: 351 case INIT_DATA_TYPE_WEBM:
352 eme_init_data_type = media::EME_INIT_DATA_TYPE_WEBM; 352 eme_init_data_type = media::EmeInitDataType::WEBM;
353 break; 353 break;
354 #if defined(USE_PROPRIETARY_CODECS) 354 #if defined(USE_PROPRIETARY_CODECS)
355 case INIT_DATA_TYPE_CENC: 355 case INIT_DATA_TYPE_CENC:
356 eme_init_data_type = media::EME_INIT_DATA_TYPE_CENC; 356 eme_init_data_type = media::EmeInitDataType::CENC;
357 break; 357 break;
358 #endif 358 #endif
359 default: 359 default:
360 NOTREACHED(); 360 NOTREACHED();
361 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, 361 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0,
362 "Invalid init data type."); 362 "Invalid init data type.");
363 return; 363 return;
364 } 364 }
365 365
366 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); 366 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (!cdm) { 552 if (!cdm) {
553 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); 553 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found.");
554 return; 554 return;
555 } 555 }
556 556
557 // TODO(ddorwin): Move this conversion to MediaDrmBridge when fixing 557 // TODO(ddorwin): Move this conversion to MediaDrmBridge when fixing
558 // crbug.com/417440. 558 // crbug.com/417440.
559 // "audio"/"video" does not matter, so use "video". 559 // "audio"/"video" does not matter, so use "video".
560 std::string init_data_type_string; 560 std::string init_data_type_string;
561 switch (init_data_type) { 561 switch (init_data_type) {
562 case media::EME_INIT_DATA_TYPE_WEBM: 562 case media::EmeInitDataType::WEBM:
563 init_data_type_string = "video/webm"; 563 init_data_type_string = "video/webm";
564 break; 564 break;
565 #if defined(USE_PROPRIETARY_CODECS) 565 #if defined(USE_PROPRIETARY_CODECS)
566 case media::EME_INIT_DATA_TYPE_CENC: 566 case media::EmeInitDataType::CENC:
567 init_data_type_string = "video/mp4"; 567 init_data_type_string = "video/mp4";
568 break; 568 break;
569 #endif 569 #endif
570 default: 570 default:
571 NOTREACHED(); 571 NOTREACHED();
572 } 572 }
573 573
574 // Only the temporary session type is supported in browser CDM path. 574 // Only the temporary session type is supported in browser CDM path.
575 // TODO(xhwang): Add SessionType support if needed. 575 // TODO(xhwang): Add SessionType support if needed.
576 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION, 576 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION,
577 init_data_type_string, &init_data[0], 577 init_data_type_string, &init_data[0],
578 init_data.size(), promise.Pass()); 578 init_data.size(), promise.Pass());
579 } 579 }
580 580
581 } // namespace content 581 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698