Skip to content

Commit

Permalink
Use absl::Span in AudioFrameObu constructor.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 694211381
  • Loading branch information
jwcullen committed Nov 11, 2024
1 parent 3db06a5 commit 1ec8bd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions iamf/obu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ cc_library(
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/types:span",
],
)

Expand Down
5 changes: 3 additions & 2 deletions iamf/obu/audio_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/types/span.h"
#include "iamf/common/macros.h"
#include "iamf/common/read_bit_buffer.h"
#include "iamf/common/write_bit_buffer.h"
Expand All @@ -42,9 +43,9 @@ ObuType GetObuType(uint32_t substream_id) {

AudioFrameObu::AudioFrameObu(const ObuHeader& header,
DecodedUleb128 substream_id,
const std::vector<uint8_t>& audio_frame)
absl::Span<const uint8_t> audio_frame)
: ObuBase(header, GetObuType(substream_id)),
audio_frame_(audio_frame),
audio_frame_(audio_frame.begin(), audio_frame.end()),
audio_substream_id_(substream_id) {}

absl::StatusOr<AudioFrameObu> AudioFrameObu::CreateFromBuffer(
Expand Down
4 changes: 3 additions & 1 deletion iamf/obu/audio_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/types/span.h"
#include "iamf/common/read_bit_buffer.h"
#include "iamf/common/write_bit_buffer.h"
#include "iamf/obu/obu_base.h"
Expand Down Expand Up @@ -58,9 +59,10 @@ class AudioFrameObu : public ObuBase {
*
* \param header `ObuHeader` of the OBU.
* \param substream_id Substream ID.
* \param audio_frame Audio frame.
*/
AudioFrameObu(const ObuHeader& header, DecodedUleb128 substream_id,
const std::vector<uint8_t>& audio_frame);
absl::Span<const uint8_t> audio_frame);

/*!\brief Destructor.*/
~AudioFrameObu() = default;
Expand Down

0 comments on commit 1ec8bd5

Please sign in to comment.