Commit 936c63b6 authored by Jose Lopes's avatar Jose Lopes Committed by Commit Bot

media: Migrate GetDecryptConfigCB to repeating callback.

This is a repeated callback because it's called from a while loop:
* https://cs.chromium.org/chromium/src/media/formats/mp2t/es_parser_adts.cc?rcl=db95e8ed4d10f4770b37e265ca78c906e344c6ef&l=212
* https://cs.chromium.org/chromium/src/media/formats/mp2t/es_parser_h264.cc?rcl=db95e8ed4d10f4770b37e265ca78c906e344c6ef&l=361

This is part of the base::Callback migration.

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

TBR=danakj@chromium.org

Bug: 714018
Change-Id: Ifb0f1119c2ed834bdfa4328afce0931c7776a626
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080354
Commit-Queue: Jose Lopes <jabolopes@google.com>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746714}
parent 70f72f2c
...@@ -30,7 +30,7 @@ class MEDIA_EXPORT EsParser { ...@@ -30,7 +30,7 @@ class MEDIA_EXPORT EsParser {
public: public:
using EmitBufferCB = using EmitBufferCB =
base::RepeatingCallback<void(scoped_refptr<StreamParserBuffer>)>; base::RepeatingCallback<void(scoped_refptr<StreamParserBuffer>)>;
using GetDecryptConfigCB = base::Callback<const DecryptConfig*()>; using GetDecryptConfigCB = base::RepeatingCallback<const DecryptConfig*()>;
EsParser(); EsParser();
virtual ~EsParser(); virtual ~EsParser();
......
...@@ -130,12 +130,12 @@ EsParserAdts::EsParserAdts(const NewAudioConfigCB& new_audio_config_cb, ...@@ -130,12 +130,12 @@ EsParserAdts::EsParserAdts(const NewAudioConfigCB& new_audio_config_cb,
#if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES)
EsParserAdts::EsParserAdts(const NewAudioConfigCB& new_audio_config_cb, EsParserAdts::EsParserAdts(const NewAudioConfigCB& new_audio_config_cb,
EmitBufferCB emit_buffer_cb, EmitBufferCB emit_buffer_cb,
const GetDecryptConfigCB& get_decrypt_config_cb, GetDecryptConfigCB get_decrypt_config_cb,
EncryptionScheme init_encryption_scheme, EncryptionScheme init_encryption_scheme,
bool sbr_in_mimetype) bool sbr_in_mimetype)
: new_audio_config_cb_(new_audio_config_cb), : new_audio_config_cb_(new_audio_config_cb),
emit_buffer_cb_(std::move(emit_buffer_cb)), emit_buffer_cb_(std::move(emit_buffer_cb)),
get_decrypt_config_cb_(get_decrypt_config_cb), get_decrypt_config_cb_(std::move(get_decrypt_config_cb)),
init_encryption_scheme_(init_encryption_scheme), init_encryption_scheme_(init_encryption_scheme),
sbr_in_mimetype_(sbr_in_mimetype) {} sbr_in_mimetype_(sbr_in_mimetype) {}
#endif #endif
......
...@@ -39,7 +39,7 @@ class MEDIA_EXPORT EsParserAdts : public EsParser { ...@@ -39,7 +39,7 @@ class MEDIA_EXPORT EsParserAdts : public EsParser {
#if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES)
EsParserAdts(const NewAudioConfigCB& new_audio_config_cb, EsParserAdts(const NewAudioConfigCB& new_audio_config_cb,
EmitBufferCB emit_buffer_cb, EmitBufferCB emit_buffer_cb,
const GetDecryptConfigCB& get_decrypt_config_cb, GetDecryptConfigCB get_decrypt_config_cb,
EncryptionScheme init_encryption_scheme, EncryptionScheme init_encryption_scheme,
bool sbr_in_mimetype); bool sbr_in_mimetype);
#endif #endif
......
...@@ -440,13 +440,14 @@ std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedH264Parser( ...@@ -440,13 +440,14 @@ std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedH264Parser(
&Mp2tStreamParser::OnVideoConfigChanged, base::Unretained(this), pes_pid); &Mp2tStreamParser::OnVideoConfigChanged, base::Unretained(this), pes_pid);
auto on_emit_video_buffer = base::BindRepeating( auto on_emit_video_buffer = base::BindRepeating(
&Mp2tStreamParser::OnEmitVideoBuffer, base::Unretained(this), pes_pid); &Mp2tStreamParser::OnEmitVideoBuffer, base::Unretained(this), pes_pid);
auto get_decrypt_config = EsParserAdts::GetDecryptConfigCB get_decrypt_config;
emit_clear_buffers ? EsParser::GetDecryptConfigCB() if (!emit_clear_buffers) {
: base::Bind(&Mp2tStreamParser::GetDecryptConfig, get_decrypt_config = base::BindRepeating(
base::Unretained(this)); &Mp2tStreamParser::GetDecryptConfig, base::Unretained(this));
}
return std::make_unique<EsParserH264>( return std::make_unique<EsParserH264>(
std::move(on_video_config_changed), on_emit_video_buffer, std::move(on_video_config_changed), on_emit_video_buffer,
initial_encryption_scheme_, get_decrypt_config); initial_encryption_scheme_, std::move(get_decrypt_config));
} }
std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedAacParser( std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedAacParser(
...@@ -456,13 +457,15 @@ std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedAacParser( ...@@ -456,13 +457,15 @@ std::unique_ptr<EsParser> Mp2tStreamParser::CreateEncryptedAacParser(
&Mp2tStreamParser::OnAudioConfigChanged, base::Unretained(this), pes_pid); &Mp2tStreamParser::OnAudioConfigChanged, base::Unretained(this), pes_pid);
auto on_emit_audio_buffer = base::BindRepeating( auto on_emit_audio_buffer = base::BindRepeating(
&Mp2tStreamParser::OnEmitAudioBuffer, base::Unretained(this), pes_pid); &Mp2tStreamParser::OnEmitAudioBuffer, base::Unretained(this), pes_pid);
auto get_decrypt_config = EsParserAdts::GetDecryptConfigCB get_decrypt_config;
emit_clear_buffers ? EsParser::GetDecryptConfigCB() if (!emit_clear_buffers) {
: base::Bind(&Mp2tStreamParser::GetDecryptConfig, get_decrypt_config = base::BindRepeating(
base::Unretained(this)); &Mp2tStreamParser::GetDecryptConfig, base::Unretained(this));
}
return std::make_unique<EsParserAdts>( return std::make_unique<EsParserAdts>(
on_audio_config_changed, std::move(on_emit_audio_buffer), on_audio_config_changed, std::move(on_emit_audio_buffer),
get_decrypt_config, initial_encryption_scheme_, sbr_in_mimetype_); std::move(get_decrypt_config), initial_encryption_scheme_,
sbr_in_mimetype_);
} }
#endif #endif
......
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