Commit e39eff90 authored by Jose Lopes's avatar Jose Lopes Committed by Commit Bot

media: Migrate RegisterPsshBoxesCb to repeating callback.

This is a repeating callback because it's called from a call chain that
links to a loop:
* https://cs.chromium.org/chromium/src/media/formats/mp2t/mp2t_stream_parser.cc?rcl=385d1322d09f871a327371f0ded2b2d70714bde2&l=873
* https://cs.chromium.org/chromium/src/media/formats/mp2t/mp2t_stream_parser.cc?rcl=385d1322d09f871a327371f0ded2b2d70714bde2&l=139
* https://cs.chromium.org/chromium/src/media/formats/mp2t/mp2t_stream_parser.cc?rcl=385d1322d09f871a327371f0ded2b2d70714bde2&l=345

This is part of the base::Callback migration.

Context: https://cs.chromium.org/chromium/src/docs/callback.md?rcl=9fcc3764aea8f97e9f6de4a9ee61d554e67edcda&l=40

Bug: 1007806
Change-Id: I51a2e7a5b0fe87b114cbedabe2040961d3bb6215
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080417
Commit-Queue: Jose Lopes <jabolopes@google.com>
Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747205}
parent 51bbc80e
......@@ -867,19 +867,17 @@ void Mp2tStreamParser::UnregisterCat() {
}
void Mp2tStreamParser::RegisterCencPids(int ca_pid, int pssh_pid) {
std::unique_ptr<TsSectionCetsEcm> ecm_parser(
new TsSectionCetsEcm(base::BindRepeating(
&Mp2tStreamParser::RegisterNewKeyIdAndIv, base::Unretained(this))));
std::unique_ptr<PidState> ecm_pid_state(
new PidState(ca_pid, PidState::kPidCetsEcm, std::move(ecm_parser)));
auto ecm_parser = std::make_unique<TsSectionCetsEcm>(base::BindRepeating(
&Mp2tStreamParser::RegisterNewKeyIdAndIv, base::Unretained(this)));
auto ecm_pid_state = std::make_unique<PidState>(ca_pid, PidState::kPidCetsEcm,
std::move(ecm_parser));
ecm_pid_state->Enable();
pids_.insert(std::make_pair(ca_pid, std::move(ecm_pid_state)));
std::unique_ptr<TsSectionCetsPssh> pssh_parser(
new TsSectionCetsPssh(base::Bind(&Mp2tStreamParser::RegisterPsshBoxes,
base::Unretained(this))));
std::unique_ptr<PidState> pssh_pid_state(
new PidState(pssh_pid, PidState::kPidCetsPssh, std::move(pssh_parser)));
auto pssh_parser = std::make_unique<TsSectionCetsPssh>(base::BindRepeating(
&Mp2tStreamParser::RegisterPsshBoxes, base::Unretained(this)));
auto pssh_pid_state = std::make_unique<PidState>(
pssh_pid, PidState::kPidCetsPssh, std::move(pssh_parser));
pssh_pid_state->Enable();
pids_.insert(std::make_pair(pssh_pid, std::move(pssh_pid_state)));
}
......
......@@ -11,9 +11,8 @@
namespace media {
namespace mp2t {
TsSectionCetsPssh::TsSectionCetsPssh(
const RegisterPsshBoxesCb& register_pssh_boxes_cb)
: register_pssh_boxes_cb_(register_pssh_boxes_cb) {}
TsSectionCetsPssh::TsSectionCetsPssh(RegisterPsshBoxesCb register_pssh_boxes_cb)
: register_pssh_boxes_cb_(std::move(register_pssh_boxes_cb)) {}
TsSectionCetsPssh::~TsSectionCetsPssh() {}
......
......@@ -18,8 +18,10 @@ namespace mp2t {
class TsSectionCetsPssh : public TsSection {
public:
using RegisterPsshBoxesCb = base::Callback<void(const std::vector<uint8_t>&)>;
explicit TsSectionCetsPssh(const RegisterPsshBoxesCb& register_pssh_boxes_cb);
using RegisterPsshBoxesCb =
base::RepeatingCallback<void(const std::vector<uint8_t>&)>;
explicit TsSectionCetsPssh(RegisterPsshBoxesCb register_pssh_boxes_cb);
~TsSectionCetsPssh() override;
// TsSection implementation.
......@@ -30,7 +32,7 @@ class TsSectionCetsPssh : public TsSection {
void Reset() override;
private:
RegisterPsshBoxesCb register_pssh_boxes_cb_;
const RegisterPsshBoxesCb register_pssh_boxes_cb_;
DISALLOW_COPY_AND_ASSIGN(TsSectionCetsPssh);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment