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

Unified Diff: media/formats/mp2t/ts_section_pmt.cc

Issue 1517473002: Support HLS MPEG2 TS with SAMPLE-AES encryption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@encryption_scheme
Patch Set: move some gn defs Created 4 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 side-by-side diff with in-line comments
Download patch
Index: media/formats/mp2t/ts_section_pmt.cc
diff --git a/media/formats/mp2t/ts_section_pmt.cc b/media/formats/mp2t/ts_section_pmt.cc
index 72b492aaa4308fb3846d93ad8937c9647003a8c1..c10851666df1415c171998e987dde27e22aacbdc 100644
--- a/media/formats/mp2t/ts_section_pmt.cc
+++ b/media/formats/mp2t/ts_section_pmt.cc
@@ -5,6 +5,7 @@
#include "media/formats/mp2t/ts_section_pmt.h"
#include <map>
+#include <string>
ddorwin 2016/04/12 00:40:48 unused?
dougsteed 2016/05/08 23:18:45 Done.
#include "base/logging.h"
#include "media/base/bit_reader.h"
@@ -79,7 +80,9 @@ bool TsSectionPmt::ParsePsiSection(BitReader* bit_reader) {
// The end of the PID map if 4 bytes away from the end of the section
// (4 bytes = size of the CRC).
int pid_map_end_marker = section_start_marker - section_length + 4;
- std::map<int, int> pid_map;
+ using PidMapValue = std::pair<int, Descriptors>;
+ using PidMapElement = std::pair<int, PidMapValue>;
+ std::map<int, PidMapValue> pid_map;
while (bit_reader->bits_available() > 8 * pid_map_end_marker) {
int stream_type;
int reserved;
@@ -91,15 +94,14 @@ bool TsSectionPmt::ParsePsiSection(BitReader* bit_reader) {
RCHECK(bit_reader->ReadBits(4, &reserved));
RCHECK(bit_reader->ReadBits(12, &es_info_length));
+ Descriptors descriptors;
+ RCHECK(descriptors.Read(bit_reader, es_info_length));
+
// Do not register the PID right away.
// Wait for the end of the section to be fully parsed
// to make sure there is no error.
- pid_map.insert(std::pair<int, int>(pid_es, stream_type));
-
- // Read the ES info descriptors.
- // TODO(damienv): check wether any of the descriptors could be useful.
- // Defined in section 2.6 of ISO-13818.
- RCHECK(bit_reader->SkipBits(8 * es_info_length));
+ PidMapValue stream_info(stream_type, descriptors);
+ pid_map.insert(PidMapElement(pid_es, stream_info));
}
// Read the CRC.
@@ -107,9 +109,8 @@ bool TsSectionPmt::ParsePsiSection(BitReader* bit_reader) {
RCHECK(bit_reader->ReadBits(32, &crc32));
// Once the PMT has been proved to be correct, register the PIDs.
- for (std::map<int, int>::iterator it = pid_map.begin();
- it != pid_map.end(); ++it)
- register_pes_cb_.Run(it->first, it->second);
+ for (const auto& it : pid_map)
+ register_pes_cb_.Run(it.first, it.second.first, it.second.second);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698