cleanup: Convert all time parameters to signed

This converts all time parameters to signed, finishing a cleanup that
was started in 2018 in b4256bf0.  This changes the type of:
  - timestamps
    - PTS specifically
  - timestamp offsets
  - timescales
  - durations

This excludes:
  - MP4 box definitions
  - DTS specifically

This is meant to address signed/unsigned conversion issues on arm64
that caused some test cases to fail.

Change-Id: Ic752a20cbc6e31fea6bc0894d1771833171e7cbe
This commit is contained in:
Joey Parrish 2021-08-04 11:56:44 -07:00
parent eba176f032
commit cfbe5c08c2
146 changed files with 546 additions and 514 deletions

View File

@ -42,7 +42,7 @@ class MuxerFactory {
/// this will replace the clock for all muxers created after this call. /// this will replace the clock for all muxers created after this call.
void OverrideClock(base::Clock* clock); void OverrideClock(base::Clock* clock);
void SetTsStreamOffset(uint32_t offset_ms) { void SetTsStreamOffset(int32_t offset_ms) {
transport_stream_timestamp_offset_ms_ = offset_ms; transport_stream_timestamp_offset_ms_ = offset_ms;
} }
@ -52,7 +52,7 @@ class MuxerFactory {
const Mp4OutputParams mp4_params_; const Mp4OutputParams mp4_params_;
const std::string temp_dir_; const std::string temp_dir_;
uint32_t transport_stream_timestamp_offset_ms_ = 0; int32_t transport_stream_timestamp_offset_ms_ = 0;
base::Clock* clock_ = nullptr; base::Clock* clock_ = nullptr;
}; };

View File

@ -157,7 +157,7 @@ HttpFile::HttpFile(HttpMethod method,
const std::string& url, const std::string& url,
const std::string& upload_content_type, const std::string& upload_content_type,
const std::vector<std::string>& headers, const std::vector<std::string>& headers,
uint32_t timeout_in_seconds) int32_t timeout_in_seconds)
: File(url.c_str()), : File(url.c_str()),
url_(url), url_(url),
upload_content_type_(upload_content_type), upload_content_type_(upload_content_type),

View File

@ -42,7 +42,7 @@ class HttpFile : public File {
const std::string& url, const std::string& url,
const std::string& upload_content_type, const std::string& upload_content_type,
const std::vector<std::string>& headers, const std::vector<std::string>& headers,
uint32_t timeout_in_seconds); int32_t timeout_in_seconds);
HttpFile(const HttpFile&) = delete; HttpFile(const HttpFile&) = delete;
HttpFile& operator=(const HttpFile&) = delete; HttpFile& operator=(const HttpFile&) = delete;
@ -75,7 +75,7 @@ class HttpFile : public File {
const std::string url_; const std::string url_;
const std::string upload_content_type_; const std::string upload_content_type_;
const uint32_t timeout_in_seconds_; const int32_t timeout_in_seconds_;
const HttpMethod method_; const HttpMethod method_;
IoCache download_cache_; IoCache download_cache_;
IoCache upload_cache_; IoCache upload_cache_;

View File

@ -48,7 +48,7 @@ class HlsNotifier {
/// @return true on success, false otherwise. This may fail if the stream /// @return true on success, false otherwise. This may fail if the stream
/// specified by @a stream_id does not exist. /// specified by @a stream_id does not exist.
virtual bool NotifySampleDuration(uint32_t stream_id, virtual bool NotifySampleDuration(uint32_t stream_id,
uint32_t sample_duration) = 0; int32_t sample_duration) = 0;
/// @param stream_id is the value set by NotifyNewStream(). /// @param stream_id is the value set by NotifyNewStream().
/// @param segment_name is the name of the new segment. /// @param segment_name is the name of the new segment.
@ -60,8 +60,8 @@ class HlsNotifier {
/// @param size is the size in bytes. /// @param size is the size in bytes.
virtual bool NotifyNewSegment(uint32_t stream_id, virtual bool NotifyNewSegment(uint32_t stream_id,
const std::string& segment_name, const std::string& segment_name,
uint64_t start_time, int64_t start_time,
uint64_t duration, int64_t duration,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) = 0; uint64_t size) = 0;
@ -72,14 +72,14 @@ class HlsNotifier {
/// @param start_byte_offset is the offset of where the keyframe starts. /// @param start_byte_offset is the offset of where the keyframe starts.
/// @param size is the size in bytes. /// @param size is the size in bytes.
virtual bool NotifyKeyFrame(uint32_t stream_id, virtual bool NotifyKeyFrame(uint32_t stream_id,
uint64_t timestamp, int64_t timestamp,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) = 0; uint64_t size) = 0;
/// @param stream_id is the value set by NotifyNewStream(). /// @param stream_id is the value set by NotifyNewStream().
/// @param timestamp is the timestamp of the CueEvent. /// @param timestamp is the timestamp of the CueEvent.
/// @return true on success, false otherwise. /// @return true on success, false otherwise.
virtual bool NotifyCueEvent(uint32_t stream_id, uint64_t timestamp) = 0; virtual bool NotifyCueEvent(uint32_t stream_id, int64_t timestamp) = 0;
/// @param stream_id is the value set by NotifyNewStream(). /// @param stream_id is the value set by NotifyNewStream().
/// @param key_id is the key ID for the stream. /// @param key_id is the key ID for the stream.

View File

@ -25,7 +25,7 @@ namespace shaka {
namespace hls { namespace hls {
namespace { namespace {
uint32_t GetTimeScale(const MediaInfo& media_info) { int32_t GetTimeScale(const MediaInfo& media_info) {
if (media_info.has_reference_time_scale()) if (media_info.has_reference_time_scale())
return media_info.reference_time_scale(); return media_info.reference_time_scale();
@ -34,7 +34,7 @@ uint32_t GetTimeScale(const MediaInfo& media_info) {
if (media_info.has_audio_info()) if (media_info.has_audio_info())
return media_info.audio_info().time_scale(); return media_info.audio_info().time_scale();
return 0u; return 0;
} }
std::string AdjustVideoCodec(const std::string& codec) { std::string AdjustVideoCodec(const std::string& codec) {
@ -103,7 +103,7 @@ void AppendExtXMap(const MediaInfo& media_info, std::string* out) {
std::string CreatePlaylistHeader( std::string CreatePlaylistHeader(
const MediaInfo& media_info, const MediaInfo& media_info,
uint32_t target_duration, int32_t target_duration,
HlsPlaylistType type, HlsPlaylistType type,
MediaPlaylist::MediaPlaylistStreamType stream_type, MediaPlaylist::MediaPlaylistStreamType stream_type,
uint32_t media_sequence_number, uint32_t media_sequence_number,
@ -371,7 +371,7 @@ void MediaPlaylist::SetCharacteristicsForTesting(
} }
bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) { bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) {
const uint32_t time_scale = GetTimeScale(media_info); const int32_t time_scale = GetTimeScale(media_info);
if (time_scale == 0) { if (time_scale == 0) {
LOG(ERROR) << "MediaInfo does not contain a valid timescale."; LOG(ERROR) << "MediaInfo does not contain a valid timescale.";
return false; return false;
@ -400,7 +400,7 @@ bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) {
return true; return true;
} }
void MediaPlaylist::SetSampleDuration(uint32_t sample_duration) { void MediaPlaylist::SetSampleDuration(int32_t sample_duration) {
if (media_info_.has_video_info()) if (media_info_.has_video_info())
media_info_.mutable_video_info()->set_frame_duration(sample_duration); media_info_.mutable_video_info()->set_frame_duration(sample_duration);
} }
@ -506,7 +506,7 @@ double MediaPlaylist::GetLongestSegmentDuration() const {
return longest_segment_duration_seconds_; return longest_segment_duration_seconds_;
} }
void MediaPlaylist::SetTargetDuration(uint32_t target_duration) { void MediaPlaylist::SetTargetDuration(int32_t target_duration) {
if (target_duration_set_) { if (target_duration_set_) {
if (target_duration_ == target_duration) if (target_duration_ == target_duration)
return; return;
@ -664,7 +664,7 @@ void MediaPlaylist::SlideWindow() {
hls_params_.playlist_type != HlsPlaylistType::kLive) { hls_params_.playlist_type != HlsPlaylistType::kLive) {
return; return;
} }
DCHECK_GT(time_scale_, 0u); DCHECK_GT(time_scale_, 0);
if (current_buffer_depth_ <= hls_params_.time_shift_buffer_depth) if (current_buffer_depth_ <= hls_params_.time_shift_buffer_depth)
return; return;

View File

@ -103,7 +103,7 @@ class MediaPlaylist {
/// Sample duration is not available right away especially. This allows /// Sample duration is not available right away especially. This allows
/// setting the sample duration after the Media Playlist has been initialized. /// setting the sample duration after the Media Playlist has been initialized.
/// @param sample_duration is the duration of a sample. /// @param sample_duration is the duration of a sample.
virtual void SetSampleDuration(uint32_t sample_duration); virtual void SetSampleDuration(int32_t sample_duration);
/// Segments must be added in order. /// Segments must be added in order.
/// @param file_name is the file name of the segment. /// @param file_name is the file name of the segment.
@ -183,7 +183,7 @@ class MediaPlaylist {
/// The spec does not allow changing EXT-X-TARGETDURATION. However, this class /// The spec does not allow changing EXT-X-TARGETDURATION. However, this class
/// has no control over the input source. /// has no control over the input source.
/// @param target_duration is the target duration for this playlist. /// @param target_duration is the target duration for this playlist.
virtual void SetTargetDuration(uint32_t target_duration); virtual void SetTargetDuration(int32_t target_duration);
/// @return number of channels for audio. 0 is returned for video. /// @return number of channels for audio. 0 is returned for video.
virtual int GetNumChannels() const; virtual int GetNumChannels() const;
@ -265,7 +265,7 @@ class MediaPlaylist {
int discontinuity_sequence_number_ = 0; int discontinuity_sequence_number_ = 0;
double longest_segment_duration_seconds_ = 0.0; double longest_segment_duration_seconds_ = 0.0;
uint32_t time_scale_ = 0; int32_t time_scale_ = 0;
BandwidthEstimator bandwidth_estimator_; BandwidthEstimator bandwidth_estimator_;
@ -275,7 +275,7 @@ class MediaPlaylist {
// See SetTargetDuration() comments. // See SetTargetDuration() comments.
bool target_duration_set_ = false; bool target_duration_set_ = false;
uint32_t target_duration_ = 0; int32_t target_duration_ = 0;
// TODO(kqyang): This could be managed better by a separate class, than having // TODO(kqyang): This could be managed better by a separate class, than having
// all them managed in MediaPlaylist. // all them managed in MediaPlaylist.

View File

@ -27,7 +27,7 @@ namespace {
const char kDefaultPlaylistFileName[] = "default_playlist.m3u8"; const char kDefaultPlaylistFileName[] = "default_playlist.m3u8";
const double kTimeShiftBufferDepth = 20; const double kTimeShiftBufferDepth = 20;
const uint64_t kTimeScale = 90000; const int64_t kTimeScale = 90000;
const uint64_t kMBytes = 1000000; const uint64_t kMBytes = 1000000;
const uint64_t kZeroByteOffset = 0; const uint64_t kZeroByteOffset = 0;
@ -1002,8 +1002,8 @@ const char kIgnoredSegmentName[] = "ignored_segment_name";
const char kSegmentTemplateTime[] = "memory://$Time$.mp4"; const char kSegmentTemplateTime[] = "memory://$Time$.mp4";
const char kSegmentTemplateTimeUrl[] = "video/$Time$.mp4"; const char kSegmentTemplateTimeUrl[] = "video/$Time$.mp4";
const uint64_t kInitialStartTime = 0; const int64_t kInitialStartTime = 0;
const uint64_t kDuration = kTimeScale; const int64_t kDuration = kTimeScale;
} // namespace } // namespace
class MediaPlaylistDeleteSegmentsTest class MediaPlaylistDeleteSegmentsTest

View File

@ -46,7 +46,7 @@ class MockMediaPlaylist : public MediaPlaylist {
MOCK_CONST_METHOD0(MaxBitrate, uint64_t()); MOCK_CONST_METHOD0(MaxBitrate, uint64_t());
MOCK_CONST_METHOD0(AvgBitrate, uint64_t()); MOCK_CONST_METHOD0(AvgBitrate, uint64_t());
MOCK_CONST_METHOD0(GetLongestSegmentDuration, double()); MOCK_CONST_METHOD0(GetLongestSegmentDuration, double());
MOCK_METHOD1(SetTargetDuration, void(uint32_t target_duration)); MOCK_METHOD1(SetTargetDuration, void(int32_t target_duration));
MOCK_CONST_METHOD0(GetNumChannels, int()); MOCK_CONST_METHOD0(GetNumChannels, int());
MOCK_CONST_METHOD0(GetEC3JocComplexity, int()); MOCK_CONST_METHOD0(GetEC3JocComplexity, int());
MOCK_CONST_METHOD0(GetAC4ImsFlag, bool()); MOCK_CONST_METHOD0(GetAC4ImsFlag, bool());

View File

@ -345,7 +345,7 @@ bool SimpleHlsNotifier::NotifyNewStream(const MediaInfo& media_info,
} }
bool SimpleHlsNotifier::NotifySampleDuration(uint32_t stream_id, bool SimpleHlsNotifier::NotifySampleDuration(uint32_t stream_id,
uint32_t sample_duration) { int32_t sample_duration) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
auto stream_iterator = stream_map_.find(stream_id); auto stream_iterator = stream_map_.find(stream_id);
if (stream_iterator == stream_map_.end()) { if (stream_iterator == stream_map_.end()) {
@ -359,8 +359,8 @@ bool SimpleHlsNotifier::NotifySampleDuration(uint32_t stream_id,
bool SimpleHlsNotifier::NotifyNewSegment(uint32_t stream_id, bool SimpleHlsNotifier::NotifyNewSegment(uint32_t stream_id,
const std::string& segment_name, const std::string& segment_name,
uint64_t start_time, int64_t start_time,
uint64_t duration, int64_t duration,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) { uint64_t size) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
@ -377,8 +377,8 @@ bool SimpleHlsNotifier::NotifyNewSegment(uint32_t stream_id,
start_byte_offset, size); start_byte_offset, size);
// Update target duration. // Update target duration.
uint32_t longest_segment_duration = int32_t longest_segment_duration =
static_cast<uint32_t>(ceil(media_playlist->GetLongestSegmentDuration())); static_cast<int32_t>(ceil(media_playlist->GetLongestSegmentDuration()));
bool target_duration_updated = false; bool target_duration_updated = false;
if (longest_segment_duration > target_duration_) { if (longest_segment_duration > target_duration_) {
target_duration_ = longest_segment_duration; target_duration_ = longest_segment_duration;
@ -409,7 +409,7 @@ bool SimpleHlsNotifier::NotifyNewSegment(uint32_t stream_id,
} }
bool SimpleHlsNotifier::NotifyKeyFrame(uint32_t stream_id, bool SimpleHlsNotifier::NotifyKeyFrame(uint32_t stream_id,
uint64_t timestamp, int64_t timestamp,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) { uint64_t size) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
@ -423,7 +423,7 @@ bool SimpleHlsNotifier::NotifyKeyFrame(uint32_t stream_id,
return true; return true;
} }
bool SimpleHlsNotifier::NotifyCueEvent(uint32_t stream_id, uint64_t timestamp) { bool SimpleHlsNotifier::NotifyCueEvent(uint32_t stream_id, int64_t timestamp) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
auto stream_iterator = stream_map_.find(stream_id); auto stream_iterator = stream_map_.find(stream_id);
if (stream_iterator == stream_map_.end()) { if (stream_iterator == stream_map_.end()) {

View File

@ -50,18 +50,18 @@ class SimpleHlsNotifier : public HlsNotifier {
const std::string& group_id, const std::string& group_id,
uint32_t* stream_id) override; uint32_t* stream_id) override;
bool NotifySampleDuration(uint32_t stream_id, bool NotifySampleDuration(uint32_t stream_id,
uint32_t sample_duration) override; int32_t sample_duration) override;
bool NotifyNewSegment(uint32_t stream_id, bool NotifyNewSegment(uint32_t stream_id,
const std::string& segment_name, const std::string& segment_name,
uint64_t start_time, int64_t start_time,
uint64_t duration, int64_t duration,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) override; uint64_t size) override;
bool NotifyKeyFrame(uint32_t stream_id, bool NotifyKeyFrame(uint32_t stream_id,
uint64_t timestamp, int64_t timestamp,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size) override; uint64_t size) override;
bool NotifyCueEvent(uint32_t container_id, uint64_t timestamp) override; bool NotifyCueEvent(uint32_t container_id, int64_t timestamp) override;
bool NotifyEncryptionUpdate( bool NotifyEncryptionUpdate(
uint32_t stream_id, uint32_t stream_id,
const std::vector<uint8_t>& key_id, const std::vector<uint8_t>& key_id,
@ -80,7 +80,7 @@ class SimpleHlsNotifier : public HlsNotifier {
}; };
std::string master_playlist_dir_; std::string master_playlist_dir_;
uint32_t target_duration_ = 0; int32_t target_duration_ = 0;
std::unique_ptr<MediaPlaylistFactory> media_playlist_factory_; std::unique_ptr<MediaPlaylistFactory> media_playlist_factory_;
std::unique_ptr<MasterPlaylist> master_playlist_; std::unique_ptr<MasterPlaylist> master_playlist_;

View File

@ -79,8 +79,8 @@ const double kTestTimeShiftBufferDepth = 1800.0;
const char kTestPrefix[] = "http://testprefix.com/"; const char kTestPrefix[] = "http://testprefix.com/";
const char kAnyOutputDir[] = "anything"; const char kAnyOutputDir[] = "anything";
const uint64_t kAnyStartTime = 10; const int64_t kAnyStartTime = 10;
const uint64_t kAnyDuration = 1000; const int64_t kAnyDuration = 1000;
const uint64_t kAnySize = 2000; const uint64_t kAnySize = 2000;
const char kCencProtectionScheme[] = "cenc"; const char kCencProtectionScheme[] = "cenc";
@ -209,8 +209,8 @@ TEST_F(SimpleHlsNotifierTest, NotifyNewSegment) {
EXPECT_CALL(*factory, CreateMock(_, _, _, _)) EXPECT_CALL(*factory, CreateMock(_, _, _, _))
.WillOnce(Return(mock_media_playlist)); .WillOnce(Return(mock_media_playlist));
const uint64_t kStartTime = 1328; const int64_t kStartTime = 1328;
const uint64_t kDuration = 398407; const int64_t kDuration = 398407;
const uint64_t kSize = 6595840; const uint64_t kSize = 6595840;
const std::string segment_name = "segmentname"; const std::string segment_name = "segmentname";
EXPECT_CALL(*mock_media_playlist, EXPECT_CALL(*mock_media_playlist,
@ -218,7 +218,7 @@ TEST_F(SimpleHlsNotifierTest, NotifyNewSegment) {
kDuration, 203, kSize)); kDuration, 203, kSize));
const double kLongestSegmentDuration = 11.3; const double kLongestSegmentDuration = 11.3;
const uint32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration). const int32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration).
EXPECT_CALL(*mock_media_playlist, GetLongestSegmentDuration()) EXPECT_CALL(*mock_media_playlist, GetLongestSegmentDuration())
.WillOnce(Return(kLongestSegmentDuration)); .WillOnce(Return(kLongestSegmentDuration));
@ -261,7 +261,7 @@ TEST_F(SimpleHlsNotifierTest, NotifyKeyFrame) {
const uint32_t stream_id = const uint32_t stream_id =
SetupStream(kCencProtectionScheme, mock_media_playlist, &notifier); SetupStream(kCencProtectionScheme, mock_media_playlist, &notifier);
const uint64_t kTimestamp = 12345; const int64_t kTimestamp = 12345;
const uint64_t kStartByteOffset = 888; const uint64_t kStartByteOffset = 888;
const uint64_t kSize = 555; const uint64_t kSize = 555;
EXPECT_CALL(*mock_media_playlist, EXPECT_CALL(*mock_media_playlist,
@ -369,7 +369,7 @@ TEST_F(SimpleHlsNotifierTest, NotifyCueEvent) {
SetupStream(kCencProtectionScheme, mock_media_playlist, &notifier); SetupStream(kCencProtectionScheme, mock_media_playlist, &notifier);
EXPECT_CALL(*mock_media_playlist, AddPlacementOpportunity()); EXPECT_CALL(*mock_media_playlist, AddPlacementOpportunity());
const uint64_t kCueEventTimestamp = 12345; const int64_t kCueEventTimestamp = 12345;
EXPECT_TRUE(notifier.NotifyCueEvent(stream_id, kCueEventTimestamp)); EXPECT_TRUE(notifier.NotifyCueEvent(stream_id, kCueEventTimestamp));
} }
@ -538,8 +538,8 @@ TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegment) {
EXPECT_CALL(*factory, CreateMock(_, _, _, _)) EXPECT_CALL(*factory, CreateMock(_, _, _, _))
.WillOnce(Return(mock_media_playlist)); .WillOnce(Return(mock_media_playlist));
const uint64_t kStartTime = 1328; const int64_t kStartTime = 1328;
const uint64_t kDuration = 398407; const int64_t kDuration = 398407;
const uint64_t kSize = 6595840; const uint64_t kSize = 6595840;
const std::string segment_name = "segmentname"; const std::string segment_name = "segmentname";
EXPECT_CALL(*mock_media_playlist, EXPECT_CALL(*mock_media_playlist,
@ -547,7 +547,7 @@ TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegment) {
kDuration, _, kSize)); kDuration, _, kSize));
const double kLongestSegmentDuration = 11.3; const double kLongestSegmentDuration = 11.3;
const uint32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration). const int32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration).
EXPECT_CALL(*mock_media_playlist, GetLongestSegmentDuration()) EXPECT_CALL(*mock_media_playlist, GetLongestSegmentDuration())
.WillOnce(Return(kLongestSegmentDuration)); .WillOnce(Return(kLongestSegmentDuration));
@ -578,8 +578,8 @@ TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegment) {
} }
TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegmentsWithMultipleStreams) { TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegmentsWithMultipleStreams) {
const uint64_t kStartTime = 1328; const int64_t kStartTime = 1328;
const uint64_t kDuration = 398407; const int64_t kDuration = 398407;
const uint64_t kSize = 6595840; const uint64_t kSize = 6595840;
InSequence in_sequence; InSequence in_sequence;
@ -619,7 +619,7 @@ TEST_P(LiveOrEventSimpleHlsNotifierTest, NotifyNewSegmentsWithMultipleStreams) {
EXPECT_CALL(*mock_media_playlist1, AddSegment(_, _, _, _, _)).Times(1); EXPECT_CALL(*mock_media_playlist1, AddSegment(_, _, _, _, _)).Times(1);
const double kLongestSegmentDuration = 11.3; const double kLongestSegmentDuration = 11.3;
const uint32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration). const int32_t kTargetDuration = 12; // ceil(kLongestSegmentDuration).
EXPECT_CALL(*mock_media_playlist1, GetLongestSegmentDuration()) EXPECT_CALL(*mock_media_playlist1, GetLongestSegmentDuration())
.WillOnce(Return(kLongestSegmentDuration)); .WillOnce(Return(kLongestSegmentDuration));

View File

@ -65,15 +65,31 @@ FourCC CodecToFourCC(Codec codec) {
} }
} // namespace } // namespace
AudioStreamInfo::AudioStreamInfo( AudioStreamInfo::AudioStreamInfo(int track_id,
int track_id, uint32_t time_scale, uint64_t duration, Codec codec, int32_t time_scale,
const std::string& codec_string, const uint8_t* codec_config, int64_t duration,
size_t codec_config_size, uint8_t sample_bits, uint8_t num_channels, Codec codec,
uint32_t sampling_frequency, uint64_t seek_preroll_ns, const std::string& codec_string,
uint64_t codec_delay_ns, uint32_t max_bitrate, uint32_t avg_bitrate, const uint8_t* codec_config,
const std::string& language, bool is_encrypted) size_t codec_config_size,
: StreamInfo(kStreamAudio, track_id, time_scale, duration, codec, uint8_t sample_bits,
codec_string, codec_config, codec_config_size, language, uint8_t num_channels,
uint32_t sampling_frequency,
uint64_t seek_preroll_ns,
uint64_t codec_delay_ns,
uint32_t max_bitrate,
uint32_t avg_bitrate,
const std::string& language,
bool is_encrypted)
: StreamInfo(kStreamAudio,
track_id,
time_scale,
duration,
codec,
codec_string,
codec_config,
codec_config_size,
language,
is_encrypted), is_encrypted),
sample_bits_(sample_bits), sample_bits_(sample_bits),
num_channels_(num_channels), num_channels_(num_channels),

View File

@ -18,13 +18,21 @@ namespace media {
class AudioStreamInfo : public StreamInfo { class AudioStreamInfo : public StreamInfo {
public: public:
/// Construct an initialized audio stream info object. /// Construct an initialized audio stream info object.
AudioStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, AudioStreamInfo(int track_id,
Codec codec, const std::string& codec_string, int32_t time_scale,
const uint8_t* codec_config, size_t codec_config_size, int64_t duration,
uint8_t sample_bits, uint8_t num_channels, Codec codec,
uint32_t sampling_frequency, uint64_t seek_preroll_ns, const std::string& codec_string,
uint64_t codec_delay_ns, uint32_t max_bitrate, const uint8_t* codec_config,
uint32_t avg_bitrate, const std::string& language, size_t codec_config_size,
uint8_t sample_bits,
uint8_t num_channels,
uint32_t sampling_frequency,
uint64_t seek_preroll_ns,
uint64_t codec_delay_ns,
uint32_t max_bitrate,
uint32_t avg_bitrate,
const std::string& language,
bool is_encrypted); bool is_encrypted);
~AudioStreamInfo() override; ~AudioStreamInfo() override;

View File

@ -10,7 +10,7 @@
namespace shaka { namespace shaka {
namespace media { namespace media {
AudioTimestampHelper::AudioTimestampHelper(uint32_t timescale, AudioTimestampHelper::AudioTimestampHelper(int32_t timescale,
uint32_t samples_per_second) uint32_t samples_per_second)
: base_timestamp_(kNoTimestamp), frame_count_(0) { : base_timestamp_(kNoTimestamp), frame_count_(0) {
DCHECK_GT(samples_per_second, 0u); DCHECK_GT(samples_per_second, 0u);

View File

@ -29,8 +29,7 @@ namespace media {
// accumulated frames to reach a target timestamp. // accumulated frames to reach a target timestamp.
class AudioTimestampHelper { class AudioTimestampHelper {
public: public:
explicit AudioTimestampHelper(uint32_t timescale, explicit AudioTimestampHelper(int32_t timescale, uint32_t samples_per_second);
uint32_t samples_per_second);
// Sets the base timestamp to |base_timestamp| and the sets count to 0. // Sets the base timestamp to |base_timestamp| and the sets count to 0.
void SetBaseTimestamp(int64_t base_timestamp); void SetBaseTimestamp(int64_t base_timestamp);

View File

@ -11,7 +11,7 @@ namespace shaka {
namespace media { namespace media {
static const uint32_t kDefaultSampleRate = 44100; static const uint32_t kDefaultSampleRate = 44100;
static const uint32_t kTimescale = 1000000; static const int32_t kTimescale = 1000000;
class AudioTimestampHelperTest : public ::testing::Test { class AudioTimestampHelperTest : public ::testing::Test {
public: public:

View File

@ -24,7 +24,7 @@ constexpr size_t kBufferSize = 64 * 1024;
HttpKeyFetcher::HttpKeyFetcher() : timeout_in_seconds_(0) {} HttpKeyFetcher::HttpKeyFetcher() : timeout_in_seconds_(0) {}
HttpKeyFetcher::HttpKeyFetcher(uint32_t timeout_in_seconds) HttpKeyFetcher::HttpKeyFetcher(int32_t timeout_in_seconds)
: timeout_in_seconds_(timeout_in_seconds) {} : timeout_in_seconds_(timeout_in_seconds) {}
HttpKeyFetcher::~HttpKeyFetcher() {} HttpKeyFetcher::~HttpKeyFetcher() {}

View File

@ -28,7 +28,7 @@ class HttpKeyFetcher : public KeyFetcher {
HttpKeyFetcher(); HttpKeyFetcher();
/// Create a fetcher with timeout. /// Create a fetcher with timeout.
/// @param timeout_in_seconds specifies the timeout in seconds. /// @param timeout_in_seconds specifies the timeout in seconds.
HttpKeyFetcher(uint32_t timeout_in_seconds); HttpKeyFetcher(int32_t timeout_in_seconds);
~HttpKeyFetcher() override; ~HttpKeyFetcher() override;
/// @name KeyFetcher implementation overrides. /// @name KeyFetcher implementation overrides.
@ -56,7 +56,7 @@ class HttpKeyFetcher : public KeyFetcher {
Status FetchInternal(HttpMethod method, const std::string& url, Status FetchInternal(HttpMethod method, const std::string& url,
const std::string& data, std::string* response); const std::string& data, std::string* response);
const uint32_t timeout_in_seconds_; const int32_t timeout_in_seconds_;
DISALLOW_COPY_AND_ASSIGN(HttpKeyFetcher); DISALLOW_COPY_AND_ASSIGN(HttpKeyFetcher);
}; };

View File

@ -80,7 +80,7 @@ TEST(DISABLED_HttpKeyFetcherTest, UrlWithPort) {
} }
TEST(DISABLED_HttpKeyFetcherTest, SmallTimeout) { TEST(DISABLED_HttpKeyFetcherTest, SmallTimeout) {
const uint32_t kTimeoutInSeconds = 1; const int32_t kTimeoutInSeconds = 1;
HttpKeyFetcher fetcher(kTimeoutInSeconds); HttpKeyFetcher fetcher(kTimeoutInSeconds);
std::string response; std::string response;
Status status = fetcher.FetchKeys(kTestUrl, kDelayTwoSecs, &response); Status status = fetcher.FetchKeys(kTestUrl, kDelayTwoSecs, &response);
@ -88,7 +88,7 @@ TEST(DISABLED_HttpKeyFetcherTest, SmallTimeout) {
} }
TEST(DISABLED_HttpKeyFetcherTest, BigTimeout) { TEST(DISABLED_HttpKeyFetcherTest, BigTimeout) {
const uint32_t kTimeoutInSeconds = 5; const int32_t kTimeoutInSeconds = 5;
HttpKeyFetcher fetcher(kTimeoutInSeconds); HttpKeyFetcher fetcher(kTimeoutInSeconds);
std::string response; std::string response;
Status status = fetcher.FetchKeys(kTestUrl, kDelayTwoSecs, &response); Status status = fetcher.FetchKeys(kTestUrl, kDelayTwoSecs, &response);

View File

@ -87,7 +87,7 @@ class KeySource {
/// key. Owner retains ownership, and may not be NULL. /// key. Owner retains ownership, and may not be NULL.
/// @return OK on success, an error status otherwise. /// @return OK on success, an error status otherwise.
virtual Status GetCryptoPeriodKey(uint32_t crypto_period_index, virtual Status GetCryptoPeriodKey(uint32_t crypto_period_index,
uint32_t crypto_period_duration_in_seconds, int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) = 0; EncryptionKey* key) = 0;

View File

@ -14,7 +14,7 @@
namespace { namespace {
const int kTrackId = 1; const int kTrackId = 1;
const uint64_t kDuration = 10000; const int64_t kDuration = 10000;
const char kCodecString[] = "codec string"; const char kCodecString[] = "codec string";
const uint8_t kSampleBits = 1; const uint8_t kSampleBits = 1;
const uint8_t kNumChannels = 2; const uint8_t kNumChannels = 2;
@ -175,25 +175,25 @@ bool MediaHandlerTestBase::IsVideoCodec(Codec codec) const {
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
uint32_t time_scale) const { int32_t time_scale) const {
return GetVideoStreamInfo(time_scale, kCodecVP9, kWidth, kHeight); return GetVideoStreamInfo(time_scale, kCodecVP9, kWidth, kHeight);
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
uint32_t time_scale, int32_t time_scale,
uint32_t width, uint32_t width,
uint64_t height) const { uint64_t height) const {
return GetVideoStreamInfo(time_scale, kCodecVP9, width, height); return GetVideoStreamInfo(time_scale, kCodecVP9, width, height);
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
uint32_t time_scale, int32_t time_scale,
Codec codec) const { Codec codec) const {
return GetVideoStreamInfo(time_scale, codec, kWidth, kHeight); return GetVideoStreamInfo(time_scale, codec, kWidth, kHeight);
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
uint32_t time_scale, int32_t time_scale,
Codec codec, Codec codec,
uint32_t width, uint32_t width,
uint64_t height) const { uint64_t height) const {
@ -205,12 +205,12 @@ std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetVideoStreamInfo(
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
uint32_t time_scale) const { int32_t time_scale) const {
return GetAudioStreamInfo(time_scale, kCodecAAC); return GetAudioStreamInfo(time_scale, kCodecAAC);
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetAudioStreamInfo(
uint32_t time_scale, int32_t time_scale,
Codec codec) const { Codec codec) const {
return std::unique_ptr<AudioStreamInfo>(new AudioStreamInfo( return std::unique_ptr<AudioStreamInfo>(new AudioStreamInfo(
kTrackId, time_scale, kDuration, codec, kCodecString, kCodecConfig, kTrackId, time_scale, kDuration, codec, kCodecString, kCodecConfig,
@ -254,7 +254,7 @@ std::unique_ptr<SegmentInfo> MediaHandlerTestBase::GetSegmentInfo(
} }
std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetTextStreamInfo( std::unique_ptr<StreamInfo> MediaHandlerTestBase::GetTextStreamInfo(
uint32_t timescale) const { int32_t timescale) const {
// None of this information is actually used by the text out handler. // None of this information is actually used by the text out handler.
// The stream info is just needed to signal the start of the stream. // The stream info is just needed to signal the start of the stream.
return std::unique_ptr<StreamInfo>( return std::unique_ptr<StreamInfo>(

View File

@ -292,23 +292,23 @@ class MediaHandlerTestBase : public ::testing::Test {
protected: protected:
bool IsVideoCodec(Codec codec) const; bool IsVideoCodec(Codec codec) const;
std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale) const; std::unique_ptr<StreamInfo> GetVideoStreamInfo(int32_t time_scale) const;
std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale, std::unique_ptr<StreamInfo> GetVideoStreamInfo(int32_t time_scale,
uint32_t width, uint32_t width,
uint64_t height) const; uint64_t height) const;
std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale, std::unique_ptr<StreamInfo> GetVideoStreamInfo(int32_t time_scale,
Codec codec) const; Codec codec) const;
std::unique_ptr<StreamInfo> GetVideoStreamInfo(uint32_t time_scale, std::unique_ptr<StreamInfo> GetVideoStreamInfo(int32_t time_scale,
Codec codec, Codec codec,
uint32_t width, uint32_t width,
uint64_t height) const; uint64_t height) const;
std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale) const; std::unique_ptr<StreamInfo> GetAudioStreamInfo(int32_t time_scale) const;
std::unique_ptr<StreamInfo> GetAudioStreamInfo(uint32_t time_scale, std::unique_ptr<StreamInfo> GetAudioStreamInfo(int32_t time_scale,
Codec codec) const; Codec codec) const;
std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp, std::shared_ptr<MediaSample> GetMediaSample(int64_t timestamp,
@ -325,7 +325,7 @@ class MediaHandlerTestBase : public ::testing::Test {
int64_t duration, int64_t duration,
bool is_subsegment) const; bool is_subsegment) const;
std::unique_ptr<StreamInfo> GetTextStreamInfo(uint32_t timescale) const; std::unique_ptr<StreamInfo> GetTextStreamInfo(int32_t timescale) const;
std::unique_ptr<TextSample> GetTextSample(const std::string& id, std::unique_ptr<TextSample> GetTextSample(const std::string& id,
int64_t start, int64_t start,

View File

@ -26,7 +26,7 @@ struct MuxerOptions {
// A positive value, in milliseconds, by which output timestamps are offset to // A positive value, in milliseconds, by which output timestamps are offset to
// compensate for negative timestamps in the input. // compensate for negative timestamps in the input.
uint32_t transport_stream_timestamp_offset_ms = 0; int32_t transport_stream_timestamp_offset_ms = 0;
/// Output file name. If segment_template is not specified, the Muxer /// Output file name. If segment_template is not specified, the Muxer
/// generates this single output file with all segments concatenated; /// generates this single output file with all segments concatenated;

View File

@ -109,7 +109,7 @@ Status ValidateSegmentTemplate(const std::string& segment_template) {
} }
std::string GetSegmentName(const std::string& segment_template, std::string GetSegmentName(const std::string& segment_template,
uint64_t segment_start_time, int64_t segment_start_time,
uint32_t segment_index, uint32_t segment_index,
uint32_t bandwidth) { uint32_t bandwidth) {
DCHECK_EQ(Status::OK, ValidateSegmentTemplate(segment_template)); DCHECK_EQ(Status::OK, ValidateSegmentTemplate(segment_template));

View File

@ -33,7 +33,7 @@ Status ValidateSegmentTemplate(const std::string& segment_template);
/// @param bandwidth represents the bit rate, in bits/sec, of the stream. /// @param bandwidth represents the bit rate, in bits/sec, of the stream.
/// @return The segment name with identifier substituted. /// @return The segment name with identifier substituted.
std::string GetSegmentName(const std::string& segment_template, std::string GetSegmentName(const std::string& segment_template,
uint64_t segment_start_time, int64_t segment_start_time,
uint32_t segment_index, uint32_t segment_index,
uint32_t bandwidth); uint32_t bandwidth);

View File

@ -61,7 +61,7 @@ TEST(MuxerUtilTest, ValidateSegmentTemplateWithFormatTag) {
} }
TEST(MuxerUtilTest, GetSegmentName) { TEST(MuxerUtilTest, GetSegmentName) {
const uint64_t kSegmentStartTime = 180180; const int64_t kSegmentStartTime = 180180;
const uint32_t kSegmentIndex = 11; const uint32_t kSegmentIndex = 11;
const uint32_t kBandwidth = 1234; const uint32_t kBandwidth = 1234;
EXPECT_EQ("12", GetSegmentName("$Number$", EXPECT_EQ("12", GetSegmentName("$Number$",
@ -118,7 +118,7 @@ TEST(MuxerUtilTest, GetSegmentName) {
} }
TEST(MuxerUtilTest, GetSegmentNameWithIndexZero) { TEST(MuxerUtilTest, GetSegmentNameWithIndexZero) {
const uint64_t kSegmentStartTime = 0; const int64_t kSegmentStartTime = 0;
const uint32_t kSegmentIndex = 0; const uint32_t kSegmentIndex = 0;
const uint32_t kBandwidth = 0; const uint32_t kBandwidth = 0;
EXPECT_EQ("1", GetSegmentName("$Number$", EXPECT_EQ("1", GetSegmentName("$Number$",
@ -143,7 +143,7 @@ TEST(MuxerUtilTest, GetSegmentNameWithIndexZero) {
} }
TEST(MuxerUtilTest, GetSegmentNameLargeTime) { TEST(MuxerUtilTest, GetSegmentNameLargeTime) {
const uint64_t kSegmentStartTime = 1601599839840ULL; const int64_t kSegmentStartTime = 1601599839840ULL;
const uint32_t kSegmentIndex = 8888888; const uint32_t kSegmentIndex = 8888888;
const uint32_t kBandwidth = 444444; const uint32_t kBandwidth = 444444;
EXPECT_EQ("1601599839840", EXPECT_EQ("1601599839840",

View File

@ -23,7 +23,7 @@ namespace media {
namespace { namespace {
const uint32_t kHttpFetchTimeout = 60; // In seconds const int32_t kHttpFetchTimeout = 60; // In seconds
const std::string kAcquireLicenseRequest = const std::string kAcquireLicenseRequest =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<soap:Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " "<soap:Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" "
@ -194,8 +194,9 @@ Status PlayReadyKeySource::GetKey(const std::vector<uint8_t>& key_id,
return Status::OK; return Status::OK;
} }
Status PlayReadyKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index, Status PlayReadyKeySource::GetCryptoPeriodKey(
uint32_t crypto_period_duration_in_seconds, uint32_t crypto_period_index,
int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) { EncryptionKey* key) {
// TODO(robinconnell): Implement key rotation. // TODO(robinconnell): Implement key rotation.

View File

@ -35,7 +35,7 @@ class PlayReadyKeySource : public KeySource {
Status GetKey(const std::vector<uint8_t>& key_id, Status GetKey(const std::vector<uint8_t>& key_id,
EncryptionKey* key) override; EncryptionKey* key) override;
Status GetCryptoPeriodKey(uint32_t crypto_period_index, Status GetCryptoPeriodKey(uint32_t crypto_period_index,
uint32_t crypto_period_duration_in_seconds, int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) override; EncryptionKey* key) override;
/// @} /// @}

View File

@ -58,8 +58,9 @@ Status RawKeySource::GetKey(const std::vector<uint8_t>& key_id,
" was not found."); " was not found.");
} }
Status RawKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index, Status RawKeySource::GetCryptoPeriodKey(
uint32_t crypto_period_duration_in_seconds, uint32_t crypto_period_index,
int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) { EncryptionKey* key) {
RETURN_IF_ERROR(GetKey(stream_label, key)); RETURN_IF_ERROR(GetKey(stream_label, key));

View File

@ -30,7 +30,7 @@ class RawKeySource : public KeySource {
Status GetKey(const std::vector<uint8_t>& key_id, Status GetKey(const std::vector<uint8_t>& key_id,
EncryptionKey* key) override; EncryptionKey* key) override;
Status GetCryptoPeriodKey(uint32_t crypto_period_index, Status GetCryptoPeriodKey(uint32_t crypto_period_index,
uint32_t crypto_period_duration_in_seconds, int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) override; EncryptionKey* key) override;
/// @} /// @}

View File

@ -33,8 +33,8 @@ std::string StreamTypeToString(StreamType type) {
StreamInfo::StreamInfo(StreamType stream_type, StreamInfo::StreamInfo(StreamType stream_type,
int track_id, int track_id,
uint32_t time_scale, int32_t time_scale,
uint64_t duration, int64_t duration,
Codec codec, Codec codec,
const std::string& codec_string, const std::string& codec_string,
const uint8_t* codec_config, const uint8_t* codec_config,

View File

@ -70,8 +70,8 @@ class StreamInfo {
StreamInfo(StreamType stream_type, StreamInfo(StreamType stream_type,
int track_id, int track_id,
uint32_t time_scale, int32_t time_scale,
uint64_t duration, int64_t duration,
Codec codec, Codec codec,
const std::string& codec_string, const std::string& codec_string,
const uint8_t* codec_config, const uint8_t* codec_config,
@ -95,8 +95,8 @@ class StreamInfo {
StreamType stream_type() const { return stream_type_; } StreamType stream_type() const { return stream_type_; }
uint32_t track_id() const { return track_id_; } uint32_t track_id() const { return track_id_; }
uint32_t time_scale() const { return time_scale_; } int32_t time_scale() const { return time_scale_; }
uint64_t duration() const { return duration_; } int64_t duration() const { return duration_; }
Codec codec() const { return codec_; } Codec codec() const { return codec_; }
const std::string& codec_string() const { return codec_string_; } const std::string& codec_string() const { return codec_string_; }
const std::vector<uint8_t>& codec_config() const { return codec_config_; } const std::vector<uint8_t>& codec_config() const { return codec_config_; }
@ -107,7 +107,7 @@ class StreamInfo {
return encryption_config_; return encryption_config_;
} }
void set_duration(uint64_t duration) { duration_ = duration; } void set_duration(int64_t duration) { duration_ = duration; }
void set_codec(Codec codec) { codec_ = codec; } void set_codec(Codec codec) { codec_ = codec; }
void set_codec_config(const std::vector<uint8_t>& data) { void set_codec_config(const std::vector<uint8_t>& data) {
codec_config_ = data; codec_config_ = data;
@ -129,9 +129,9 @@ class StreamInfo {
StreamType stream_type_; StreamType stream_type_;
uint32_t track_id_; uint32_t track_id_;
// The actual time is calculated as time / time_scale_ in seconds. // The actual time is calculated as time / time_scale_ in seconds.
uint32_t time_scale_; int32_t time_scale_;
// Duration base on time_scale. // Duration base on time_scale.
uint64_t duration_; int64_t duration_;
Codec codec_; Codec codec_;
std::string codec_string_; std::string codec_string_;
std::string language_; std::string language_;

View File

@ -76,8 +76,8 @@ Status TextMuxer::FinalizeSegment(size_t stream_id,
const std::string& segment_template = options().segment_template; const std::string& segment_template = options().segment_template;
DCHECK(!segment_template.empty()); DCHECK(!segment_template.empty());
const uint32_t index = segment_index_++; const uint32_t index = segment_index_++;
const uint64_t start = segment_info.start_timestamp; const int64_t start = segment_info.start_timestamp;
const uint64_t duration = segment_info.duration; const int64_t duration = segment_info.duration;
const uint32_t bandwidth = options().bandwidth; const uint32_t bandwidth = options().bandwidth;
const std::string filename = const std::string filename =

View File

@ -36,8 +36,8 @@ class TextMuxer : public Muxer {
/// also clear any buffered samples. /// also clear any buffered samples.
virtual Status WriteToFile(const std::string& filename, uint64_t* size) = 0; virtual Status WriteToFile(const std::string& filename, uint64_t* size) = 0;
uint64_t total_duration_ms_ = 0; int64_t total_duration_ms_ = 0;
uint64_t last_cue_ms_ = 0; int64_t last_cue_ms_ = 0;
uint32_t segment_index_ = 0; uint32_t segment_index_ = 0;
}; };

View File

@ -11,16 +11,25 @@
namespace shaka { namespace shaka {
namespace media { namespace media {
TextStreamInfo::TextStreamInfo(int track_id, uint32_t time_scale, TextStreamInfo::TextStreamInfo(int track_id,
uint64_t duration, int32_t time_scale,
int64_t duration,
Codec codec, Codec codec,
const std::string& codec_string, const std::string& codec_string,
const std::string& codec_config, uint16_t width, const std::string& codec_config,
uint16_t height, const std::string& language) uint16_t width,
: StreamInfo(kStreamText, track_id, time_scale, duration, codec, uint16_t height,
const std::string& language)
: StreamInfo(kStreamText,
track_id,
time_scale,
duration,
codec,
codec_string, codec_string,
reinterpret_cast<const uint8_t*>(codec_config.data()), reinterpret_cast<const uint8_t*>(codec_config.data()),
codec_config.size(), language, false), codec_config.size(),
language,
false),
width_(width), width_(width),
height_(height) {} height_(height) {}

View File

@ -60,11 +60,15 @@ class TextStreamInfo : public StreamInfo {
/// @param width of the text. This may be 0. /// @param width of the text. This may be 0.
/// @param height of the text. This may be 0. /// @param height of the text. This may be 0.
/// @param language is the language of this stream. This may be empty. /// @param language is the language of this stream. This may be empty.
TextStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, TextStreamInfo(int track_id,
int32_t time_scale,
int64_t duration,
Codec codec, Codec codec,
const std::string& codec_string, const std::string& codec_string,
const std::string& codec_config, uint16_t width, const std::string& codec_config,
uint16_t height, const std::string& language); uint16_t width,
uint16_t height,
const std::string& language);
~TextStreamInfo() override; ~TextStreamInfo() override;

View File

@ -39,8 +39,8 @@ std::string VideoCodecToString(Codec codec) {
} // namespace } // namespace
VideoStreamInfo::VideoStreamInfo(int track_id, VideoStreamInfo::VideoStreamInfo(int track_id,
uint32_t time_scale, int32_t time_scale,
uint64_t duration, int64_t duration,
Codec codec, Codec codec,
H26xStreamFormat h26x_stream_format, H26xStreamFormat h26x_stream_format,
const std::string& codec_string, const std::string& codec_string,

View File

@ -28,8 +28,8 @@ class VideoStreamInfo : public StreamInfo {
/// @param pixel_width is the width of the pixel. 0 if unknown. /// @param pixel_width is the width of the pixel. 0 if unknown.
/// @param pixel_height is the height of the pixels. 0 if unknown. /// @param pixel_height is the height of the pixels. 0 if unknown.
VideoStreamInfo(int track_id, VideoStreamInfo(int track_id,
uint32_t time_scale, int32_t time_scale,
uint64_t duration, int64_t duration,
Codec codec, Codec codec,
H26xStreamFormat h26x_stream_format, H26xStreamFormat h26x_stream_format,
const std::string& codec_string, const std::string& codec_string,

View File

@ -216,8 +216,9 @@ Status WidevineKeySource::GetKey(const std::vector<uint8_t>& key_id,
"Cannot find key with specified key ID"); "Cannot find key with specified key ID");
} }
Status WidevineKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index, Status WidevineKeySource::GetCryptoPeriodKey(
uint32_t crypto_period_duration_in_seconds, uint32_t crypto_period_index,
int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) { EncryptionKey* key) {
DCHECK(key_production_thread_.HasBeenStarted()); DCHECK(key_production_thread_.HasBeenStarted());

View File

@ -48,7 +48,7 @@ class WidevineKeySource : public KeySource {
Status GetKey(const std::vector<uint8_t>& key_id, Status GetKey(const std::vector<uint8_t>& key_id,
EncryptionKey* key) override; EncryptionKey* key) override;
Status GetCryptoPeriodKey(uint32_t crypto_period_index, Status GetCryptoPeriodKey(uint32_t crypto_period_index,
uint32_t crypto_period_duration_in_seconds, int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) override; EncryptionKey* key) override;
/// @} /// @}
@ -130,7 +130,7 @@ class WidevineKeySource : public KeySource {
bool key_production_started_ = false; bool key_production_started_ = false;
base::WaitableEvent start_key_production_; base::WaitableEvent start_key_production_;
uint32_t first_crypto_period_index_ = 0; uint32_t first_crypto_period_index_ = 0;
uint32_t crypto_period_duration_in_seconds_ = 0; int32_t crypto_period_duration_in_seconds_ = 0;
std::vector<uint8_t> group_id_; std::vector<uint8_t> group_id_;
bool enable_entitlement_license_ = false; bool enable_entitlement_license_ = false;
std::unique_ptr<EncryptionKeyQueue> key_pool_; std::unique_ptr<EncryptionKeyQueue> key_pool_;

View File

@ -88,7 +88,7 @@ Status ChunkingHandler::OnCueEvent(std::shared_ptr<const CueEvent> event) {
Status ChunkingHandler::OnMediaSample( Status ChunkingHandler::OnMediaSample(
std::shared_ptr<const MediaSample> sample) { std::shared_ptr<const MediaSample> sample) {
DCHECK_NE(time_scale_, 0u) << "kStreamInfo should arrive before kMediaSample"; DCHECK_GT(time_scale_, 0) << "kStreamInfo should arrive before kMediaSample";
const int64_t timestamp = sample->pts(); const int64_t timestamp = sample->pts();

View File

@ -81,7 +81,7 @@ class ChunkingHandler : public MediaHandler {
base::Optional<int64_t> segment_start_time_; base::Optional<int64_t> segment_start_time_;
base::Optional<int64_t> subsegment_start_time_; base::Optional<int64_t> subsegment_start_time_;
int64_t max_segment_time_ = 0; int64_t max_segment_time_ = 0;
uint32_t time_scale_ = 0; int32_t time_scale_ = 0;
// The offset is applied to sample timestamps so a full segment is generated // The offset is applied to sample timestamps so a full segment is generated
// after cue points. // after cue points.

View File

@ -20,8 +20,8 @@ namespace shaka {
namespace media { namespace media {
namespace { namespace {
const size_t kStreamIndex = 0; const size_t kStreamIndex = 0;
const uint32_t kTimeScale0 = 800; const int32_t kTimeScale0 = 800;
const uint32_t kTimeScale1 = 1000; const int32_t kTimeScale1 = 1000;
const int64_t kDuration = 300; const int64_t kDuration = 300;
const bool kKeyFrame = true; const bool kKeyFrame = true;
const bool kIsSubsegment = true; const bool kIsSubsegment = true;

View File

@ -46,7 +46,7 @@ int64_t GetScaledTime(const StreamInfo& info, const StreamData& data) {
double TimeInSeconds(const StreamInfo& info, const StreamData& data) { double TimeInSeconds(const StreamInfo& info, const StreamData& data) {
const int64_t scaled_time = GetScaledTime(info, data); const int64_t scaled_time = GetScaledTime(info, data);
const uint32_t time_scale = info.time_scale(); const int32_t time_scale = info.time_scale();
return static_cast<double>(scaled_time) / time_scale; return static_cast<double>(scaled_time) / time_scale;
} }
@ -55,7 +55,7 @@ double TextEndTimeInSeconds(const StreamInfo& info, const StreamData& data) {
DCHECK(data.text_sample); DCHECK(data.text_sample);
const int64_t scaled_time = data.text_sample->EndTime(); const int64_t scaled_time = data.text_sample->EndTime();
const uint32_t time_scale = info.time_scale(); const int32_t time_scale = info.time_scale();
return static_cast<double>(scaled_time) / time_scale; return static_cast<double>(scaled_time) / time_scale;
} }

View File

@ -30,7 +30,7 @@ const size_t kThreeOutputs = 3;
const bool kKeyFrame = true; const bool kKeyFrame = true;
const uint32_t kMsTimeScale = 1000; const int32_t kMsTimeScale = 1000;
const size_t kStreamIndex = 0; const size_t kStreamIndex = 0;
} // namespace } // namespace

View File

@ -18,7 +18,7 @@ namespace media {
namespace { namespace {
const uint64_t kStreamIndex = 0; const uint64_t kStreamIndex = 0;
const uint64_t kMsTimeScale = 1000u; const int64_t kTimescaleMs = 1000;
const size_t kInputs = 1; const size_t kInputs = 1;
const size_t kOutputs = 1; const size_t kOutputs = 1;
@ -29,8 +29,6 @@ const size_t kOutput = 0;
const bool kEncrypted = true; const bool kEncrypted = true;
const bool kSubSegment = true; const bool kSubSegment = true;
const uint64_t kTimescaleMs = 1000;
const char* kNoId = ""; const char* kNoId = "";
const char* kNoPayload = ""; const char* kNoPayload = "";
} // namespace } // namespace
@ -83,7 +81,7 @@ TEST_F(TextChunkerTest, SegmentsStartAtFirstSample) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload))));
@ -128,7 +126,7 @@ TEST_F(TextChunkerTest, SampleEndingOnSegmentStart) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload))));
@ -188,7 +186,7 @@ TEST_F(TextChunkerTest, CreatesSegmentsForSamples) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload))));
@ -258,7 +256,7 @@ TEST_F(TextChunkerTest, OutputsEmptySegments) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload))));
@ -409,7 +407,7 @@ TEST_F(TextChunkerTest, PreservesOrder) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kSampleAId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kSampleAId, kSampleAStart, kSampleAEnd, kNoPayload))));
@ -508,7 +506,7 @@ TEST_F(TextChunkerTest, NestedSamples) {
} }
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromStreamInfo(
kStreamIndex, GetTextStreamInfo(kMsTimeScale)))); kStreamIndex, GetTextStreamInfo(kTimescaleMs))));
ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample( ASSERT_OK(Input(kInput)->Dispatch(StreamData::FromTextSample(
kStreamIndex, kStreamIndex,
GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload)))); GetTextSample(kNoId, kSampleAStart, kSampleAEnd, kNoPayload))));

View File

@ -279,8 +279,8 @@ Status EncryptionHandler::ProcessMediaSample(
// in that case. // in that case.
const int64_t dts = std::max(clear_sample->dts(), static_cast<int64_t>(0)); const int64_t dts = std::max(clear_sample->dts(), static_cast<int64_t>(0));
const int64_t current_crypto_period_index = dts / crypto_period_duration_; const int64_t current_crypto_period_index = dts / crypto_period_duration_;
const uint32_t crypto_period_duration_in_seconds = const int32_t crypto_period_duration_in_seconds = static_cast<int32_t>(
static_cast<uint32_t>(encryption_params_.crypto_period_duration_in_seconds); encryption_params_.crypto_period_duration_in_seconds);
if (current_crypto_period_index != prev_crypto_period_index_) { if (current_crypto_period_index != prev_crypto_period_index_) {
EncryptionKey encryption_key; EncryptionKey encryption_key;
RETURN_IF_ERROR(key_source_->GetCryptoPeriodKey( RETURN_IF_ERROR(key_source_->GetCryptoPeriodKey(

View File

@ -79,7 +79,7 @@ class EncryptionHandler : public MediaHandler {
// Remaining clear lead in the stream's time scale. // Remaining clear lead in the stream's time scale.
int64_t remaining_clear_lead_ = 0; int64_t remaining_clear_lead_ = 0;
// Crypto period duration in the stream's time scale. // Crypto period duration in the stream's time scale.
uint64_t crypto_period_duration_ = 0; int64_t crypto_period_duration_ = 0;
// Previous crypto period index if key rotation is enabled. // Previous crypto period index if key rotation is enabled.
int64_t prev_crypto_period_index_ = -1; int64_t prev_crypto_period_index_ = -1;
bool check_new_crypto_period_ = false; bool check_new_crypto_period_ = false;

View File

@ -38,7 +38,7 @@ using ::testing::ValuesIn;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
const size_t kStreamIndex = 0; const size_t kStreamIndex = 0;
const uint32_t kTimeScale = 1000; const int32_t kTimeScale = 1000;
const char kAudioStreamLabel[] = "AUDIO"; const char kAudioStreamLabel[] = "AUDIO";
const char kSdVideoStreamLabel[] = "SD"; const char kSdVideoStreamLabel[] = "SD";
@ -66,7 +66,7 @@ class MockKeySource : public RawKeySource {
Status(const std::string& stream_label, EncryptionKey* key)); Status(const std::string& stream_label, EncryptionKey* key));
MOCK_METHOD4(GetCryptoPeriodKey, MOCK_METHOD4(GetCryptoPeriodKey,
Status(uint32_t crypto_period_index, Status(uint32_t crypto_period_index,
uint32_t crypto_period_duration_in_seconds, int32_t crypto_period_duration_in_seconds,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key)); EncryptionKey* key));
}; };

View File

@ -52,8 +52,8 @@ const uint8_t kH264CodecConfig[] = {
}; };
const uint8_t kAV1CodecConfig[] = {0x00, 0x01, 0x02, 0x03}; const uint8_t kAV1CodecConfig[] = {0x00, 0x01, 0x02, 0x03};
const int kTrackId = 1; const int kTrackId = 1;
const uint32_t kTimeScale = 1000; const int32_t kTimeScale = 1000;
const uint64_t kDuration = 10000; const int64_t kDuration = 10000;
const char kCodecString[] = "codec string"; const char kCodecString[] = "codec string";
const char kLanguage[] = "eng"; const char kLanguage[] = "eng";
const bool kEncrypted = true; const bool kEncrypted = true;

View File

@ -35,7 +35,7 @@ void CombinedMuxerListener::OnEncryptionStart() {
void CombinedMuxerListener::OnMediaStart(const MuxerOptions& muxer_options, void CombinedMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) { ContainerType container_type) {
for (auto& listener : muxer_listeners_) { for (auto& listener : muxer_listeners_) {
listener->OnMediaStart(muxer_options, stream_info, time_scale, listener->OnMediaStart(muxer_options, stream_info, time_scale,
@ -43,7 +43,7 @@ void CombinedMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
} }
} }
void CombinedMuxerListener::OnSampleDurationReady(uint32_t sample_duration) { void CombinedMuxerListener::OnSampleDurationReady(int32_t sample_duration) {
for (auto& listener : muxer_listeners_) { for (auto& listener : muxer_listeners_) {
listener->OnSampleDurationReady(sample_duration); listener->OnSampleDurationReady(sample_duration);
} }

View File

@ -34,9 +34,9 @@ class CombinedMuxerListener : public MuxerListener {
void OnEncryptionStart() override; void OnEncryptionStart() override;
void OnMediaStart(const MuxerOptions& muxer_options, void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) override; ContainerType container_type) override;
void OnSampleDurationReady(uint32_t sample_duration) override; void OnSampleDurationReady(int32_t sample_duration) override;
void OnMediaEnd(const MediaRanges& media_ranges, void OnMediaEnd(const MediaRanges& media_ranges,
float duration_seconds) override; float duration_seconds) override;
void OnNewSegment(const std::string& file_name, void OnNewSegment(const std::string& file_name,

View File

@ -84,7 +84,7 @@ void HlsNotifyMuxerListener::OnEncryptionStart() {
void HlsNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options, void HlsNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) { ContainerType container_type) {
std::unique_ptr<MediaInfo> media_info(new MediaInfo); std::unique_ptr<MediaInfo> media_info(new MediaInfo);
if (!internal::GenerateMediaInfo(muxer_options, stream_info, time_scale, if (!internal::GenerateMediaInfo(muxer_options, stream_info, time_scale,
@ -125,7 +125,7 @@ void HlsNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
} }
} }
void HlsNotifyMuxerListener::OnSampleDurationReady(uint32_t sample_duration) { void HlsNotifyMuxerListener::OnSampleDurationReady(int32_t sample_duration) {
if (stream_id_) { if (stream_id_) {
// This happens in live mode. // This happens in live mode.
hls_notifier_->NotifySampleDuration(stream_id_.value(), sample_duration); hls_notifier_->NotifySampleDuration(stream_id_.value(), sample_duration);

View File

@ -59,9 +59,9 @@ class HlsNotifyMuxerListener : public MuxerListener {
void OnEncryptionStart() override; void OnEncryptionStart() override;
void OnMediaStart(const MuxerOptions& muxer_options, void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) override; ContainerType container_type) override;
void OnSampleDurationReady(uint32_t sample_duration) override; void OnSampleDurationReady(int32_t sample_duration) override;
void OnMediaEnd(const MediaRanges& media_ranges, void OnMediaEnd(const MediaRanges& media_ranges,
float duration_seconds) override; float duration_seconds) override;
void OnNewSegment(const std::string& file_name, void OnNewSegment(const std::string& file_name,

View File

@ -39,20 +39,20 @@ class MockHlsNotifier : public hls::HlsNotifier {
const std::string& group_id, const std::string& group_id,
uint32_t* stream_id)); uint32_t* stream_id));
MOCK_METHOD2(NotifySampleDuration, MOCK_METHOD2(NotifySampleDuration,
bool(uint32_t stream_id, uint32_t sample_duration)); bool(uint32_t stream_id, int32_t sample_duration));
MOCK_METHOD6(NotifyNewSegment, MOCK_METHOD6(NotifyNewSegment,
bool(uint32_t stream_id, bool(uint32_t stream_id,
const std::string& segment_name, const std::string& segment_name,
uint64_t start_time, int64_t start_time,
uint64_t duration, int64_t duration,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size)); uint64_t size));
MOCK_METHOD4(NotifyKeyFrame, MOCK_METHOD4(NotifyKeyFrame,
bool(uint32_t stream_id, bool(uint32_t stream_id,
uint64_t timestamp, int64_t timestamp,
uint64_t start_byte_offset, uint64_t start_byte_offset,
uint64_t size)); uint64_t size));
MOCK_METHOD2(NotifyCueEvent, bool(uint32_t stream_id, uint64_t timestamp)); MOCK_METHOD2(NotifyCueEvent, bool(uint32_t stream_id, int64_t timestamp));
MOCK_METHOD5( MOCK_METHOD5(
NotifyEncryptionUpdate, NotifyEncryptionUpdate,
bool(uint32_t stream_id, bool(uint32_t stream_id,
@ -75,13 +75,13 @@ const uint8_t kAnyData[] = {
}; };
const uint64_t kSegmentStartOffset = 10000; const uint64_t kSegmentStartOffset = 10000;
const uint64_t kSegmentStartTime = 19283; const int64_t kSegmentStartTime = 19283;
const uint64_t kSegmentDuration = 98028; const int64_t kSegmentDuration = 98028;
const uint64_t kSegmentSize = 756739; const uint64_t kSegmentSize = 756739;
const uint64_t kCueStartTime = kSegmentStartTime; const int64_t kCueStartTime = kSegmentStartTime;
const uint64_t kKeyFrameTimestamp = 20123; const int64_t kKeyFrameTimestamp = 20123;
const uint64_t kKeyFrameStartByteOffset = 3456; const uint64_t kKeyFrameStartByteOffset = 3456;
const uint64_t kKeyFrameSize = 543234; const uint64_t kKeyFrameSize = 543234;

View File

@ -35,10 +35,10 @@ class MockMuxerListener : public MuxerListener {
MOCK_METHOD4(OnMediaStart, MOCK_METHOD4(OnMediaStart,
void(const MuxerOptions& muxer_options, void(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type)); ContainerType container_type));
MOCK_METHOD1(OnSampleDurationReady, void(uint32_t sample_duration)); MOCK_METHOD1(OnSampleDurationReady, void(int32_t sample_duration));
MOCK_METHOD9(OnMediaEndMock, MOCK_METHOD9(OnMediaEndMock,
void(bool has_init_range, void(bool has_init_range,

View File

@ -57,10 +57,9 @@ void MpdNotifyMuxerListener::OnEncryptionInfoReady(
void MpdNotifyMuxerListener::OnEncryptionStart() {} void MpdNotifyMuxerListener::OnEncryptionStart() {}
void MpdNotifyMuxerListener::OnMediaStart( void MpdNotifyMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) { ContainerType container_type) {
std::unique_ptr<MediaInfo> media_info(new MediaInfo()); std::unique_ptr<MediaInfo> media_info(new MediaInfo());
if (!internal::GenerateMediaInfo(muxer_options, if (!internal::GenerateMediaInfo(muxer_options,
@ -108,8 +107,7 @@ void MpdNotifyMuxerListener::OnMediaStart(
// Record the sample duration in the media info for VOD so that OnMediaEnd, all // Record the sample duration in the media info for VOD so that OnMediaEnd, all
// the information is in the media info. // the information is in the media info.
void MpdNotifyMuxerListener::OnSampleDurationReady( void MpdNotifyMuxerListener::OnSampleDurationReady(int32_t sample_duration) {
uint32_t sample_duration) {
if (mpd_notifier_->dash_profile() == DashProfile::kLive) { if (mpd_notifier_->dash_profile() == DashProfile::kLive) {
mpd_notifier_->NotifySampleDuration(notification_id_.value(), mpd_notifier_->NotifySampleDuration(notification_id_.value(),
sample_duration); sample_duration);

View File

@ -42,9 +42,9 @@ class MpdNotifyMuxerListener : public MuxerListener {
void OnEncryptionStart() override; void OnEncryptionStart() override;
void OnMediaStart(const MuxerOptions& muxer_options, void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) override; ContainerType container_type) override;
void OnSampleDurationReady(uint32_t sample_duration) override; void OnSampleDurationReady(int32_t sample_duration) override;
void OnMediaEnd(const MediaRanges& media_ranges, void OnMediaEnd(const MediaRanges& media_ranges,
float duration_seconds) override; float duration_seconds) override;
void OnNewSegment(const std::string& file_name, void OnNewSegment(const std::string& file_name,

View File

@ -279,7 +279,7 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReady) {
VideoStreamInfoParameters video_params = GetDefaultVideoStreamInfoParams(); VideoStreamInfoParameters video_params = GetDefaultVideoStreamInfoParams();
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint32_t kSampleDuration = 1234u; const int32_t kSampleDuration = 1234;
const char kExpectedMediaInfo[] = const char kExpectedMediaInfo[] =
"video_info {\n" "video_info {\n"
" frame_duration: 1234\n" // Should match the constant above. " frame_duration: 1234\n" // Should match the constant above.
@ -303,7 +303,7 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReady) {
"media_file_name: 'test_output_file_name.mp4'\n" "media_file_name: 'test_output_file_name.mp4'\n"
"media_duration_seconds: 10.5\n"; "media_duration_seconds: 10.5\n";
const uint32_t kReferenceTimeScale = 1111u; // Should match the protobuf. const int32_t kReferenceTimeScale = 1111; // Should match the protobuf.
EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0); EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0);
listener_->OnMediaStart(muxer_options, *video_stream_info, listener_->OnMediaStart(muxer_options, *video_stream_info,
@ -326,7 +326,7 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReadySegmentList) {
VideoStreamInfoParameters video_params = GetDefaultVideoStreamInfoParams(); VideoStreamInfoParameters video_params = GetDefaultVideoStreamInfoParams();
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint32_t kSampleDuration = 1234u; const int32_t kSampleDuration = 1234;
const char kExpectedMediaInfo[] = const char kExpectedMediaInfo[] =
"video_info {\n" "video_info {\n"
" frame_duration: 1234\n" // Should match the constant above. " frame_duration: 1234\n" // Should match the constant above.
@ -353,7 +353,7 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnSampleDurationReadySegmentList) {
" begin: 222\n" " begin: 222\n"
" end: 9999\n" " end: 9999\n"
"}\n"; "}\n";
const uint32_t kReferenceTimeScale = 1111u; // Should match the protobuf. const int32_t kReferenceTimeScale = 1111; // Should match the protobuf.
EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0); EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0);
listener_->OnMediaStart(muxer_options, *video_stream_info, listener_->OnMediaStart(muxer_options, *video_stream_info,
@ -378,11 +378,11 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnNewSegment) {
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0); EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0);
@ -416,11 +416,11 @@ TEST_F(MpdNotifyMuxerListenerTest, VodOnNewSegmentSegmentList) {
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0); EXPECT_CALL(*notifier_, NotifyNewContainer(_, _)).Times(0);
@ -466,11 +466,11 @@ TEST_F(MpdNotifyMuxerListenerTest, VodMultipleFiles) {
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
// Expectation for first file before OnMediaEnd. // Expectation for first file before OnMediaEnd.
@ -528,11 +528,11 @@ TEST_F(MpdNotifyMuxerListenerTest, VodMultipleFilesSegmentList) {
std::shared_ptr<StreamInfo> video_stream_info = std::shared_ptr<StreamInfo> video_stream_info =
CreateVideoStreamInfo(video_params); CreateVideoStreamInfo(video_params);
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
// Expectation for first file before OnMediaEnd. // Expectation for first file before OnMediaEnd.
@ -605,11 +605,11 @@ TEST_P(MpdNotifyMuxerListenerTest, LiveNoKeyRotation) {
" include_mspr_pro: 1\n" " include_mspr_pro: 1\n"
"}\n"; "}\n";
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
const std::vector<uint8_t> default_key_id( const std::vector<uint8_t> default_key_id(
kDefaultKeyId, kDefaultKeyId + arraysize(kDefaultKeyId) - 1); kDefaultKeyId, kDefaultKeyId + arraysize(kDefaultKeyId) - 1);
@ -678,11 +678,11 @@ TEST_P(MpdNotifyMuxerListenerTest, LiveWithKeyRotation) {
" include_mspr_pro: 1\n" " include_mspr_pro: 1\n"
"}\n"; "}\n";
const uint64_t kStartTime1 = 0u; const int64_t kStartTime1 = 0;
const uint64_t kDuration1 = 1000u; const int64_t kDuration1 = 1000;
const uint64_t kSegmentFileSize1 = 29812u; const uint64_t kSegmentFileSize1 = 29812u;
const uint64_t kStartTime2 = 1001u; const int64_t kStartTime2 = 1001;
const uint64_t kDuration2 = 3787u; const int64_t kDuration2 = 3787;
const uint64_t kSegmentFileSize2 = 83743u; const uint64_t kSegmentFileSize2 = 83743u;
const std::vector<uint8_t> default_key_id( const std::vector<uint8_t> default_key_id(
kDefaultKeyId, kDefaultKeyId + arraysize(kDefaultKeyId) - 1); kDefaultKeyId, kDefaultKeyId + arraysize(kDefaultKeyId) - 1);

View File

@ -15,7 +15,7 @@ namespace media {
void MultiCodecMuxerListener::OnMediaStart(const MuxerOptions& muxer_options, void MultiCodecMuxerListener::OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) { ContainerType container_type) {
size_t num_codecs = 0; size_t num_codecs = 0;
for (const std::string& codec_string : for (const std::string& codec_string :

View File

@ -27,7 +27,7 @@ class MultiCodecMuxerListener : public CombinedMuxerListener {
/// @{ /// @{
void OnMediaStart(const MuxerOptions& muxer_options, void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) override; ContainerType container_type) override;
/// @} /// @}

View File

@ -23,10 +23,10 @@ using ::testing::StrictMock;
namespace { namespace {
const uint64_t kSegmentStartTime = 19283; const int64_t kSegmentStartTime = 19283;
const uint64_t kSegmentDuration = 98028; const int64_t kSegmentDuration = 98028;
const uint64_t kSegmentSize = 756739; const uint64_t kSegmentSize = 756739;
const uint32_t kTimescale = 90000; const int32_t kTimescale = 90000;
MuxerListener::ContainerType kContainer = MuxerListener::kContainerMpeg2ts; MuxerListener::ContainerType kContainer = MuxerListener::kContainerMpeg2ts;
} // namespace } // namespace

View File

@ -97,12 +97,12 @@ class MuxerListener {
/// @param container_type is the container of this media. /// @param container_type is the container of this media.
virtual void OnMediaStart(const MuxerOptions& muxer_options, virtual void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) = 0; ContainerType container_type) = 0;
/// Called when the average sample duration of the media is determined. /// Called when the average sample duration of the media is determined.
/// @param sample_duration in timescale of the media. /// @param sample_duration in timescale of the media.
virtual void OnSampleDurationReady(uint32_t sample_duration) = 0; virtual void OnSampleDurationReady(int32_t sample_duration) = 0;
/// Called when all files are written out and the muxer object does not output /// Called when all files are written out and the muxer object does not output
/// any more files. /// any more files.

View File

@ -226,7 +226,7 @@ MediaInfo GetCompatibleComparisonMediaInfo(const MediaInfo& media_info) {
bool GenerateMediaInfo(const MuxerOptions& muxer_options, bool GenerateMediaInfo(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t reference_time_scale, int32_t reference_time_scale,
MuxerListener::ContainerType container_type, MuxerListener::ContainerType container_type,
MediaInfo* media_info) { MediaInfo* media_info) {
DCHECK(media_info); DCHECK(media_info);

View File

@ -29,7 +29,7 @@ namespace internal {
/// @return true on success, false otherwise. /// @return true on success, false otherwise.
bool GenerateMediaInfo(const MuxerOptions& muxer_options, bool GenerateMediaInfo(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t reference_time_scale_, int32_t reference_time_scale_,
MuxerListener::ContainerType container_type, MuxerListener::ContainerType container_type,
MediaInfo* media_info); MediaInfo* media_info);

View File

@ -15,7 +15,7 @@ namespace shaka {
namespace media { namespace media {
namespace internal { namespace internal {
namespace { namespace {
const uint32_t kReferenceTimeScale = 1000; const int32_t kReferenceTimeScale = 1000;
} // namespace } // namespace
class MuxerListenerInternalTest : public ::testing::Test {}; class MuxerListenerInternalTest : public ::testing::Test {};

View File

@ -29,8 +29,8 @@ std::shared_ptr<VideoStreamInfo> CreateVideoStreamInfo(
VideoStreamInfoParameters GetDefaultVideoStreamInfoParams() { VideoStreamInfoParameters GetDefaultVideoStreamInfoParams() {
const int kTrackId = 0; const int kTrackId = 0;
const uint32_t kTimeScale = 10; const int32_t kTimeScale = 10;
const uint64_t kVideoStreamDuration = 200; const int64_t kVideoStreamDuration = 200;
const Codec kH264Codec = kCodecH264; const Codec kH264Codec = kCodecH264;
const char* kCodecString = "avc1.010101"; const char* kCodecString = "avc1.010101";
const char* kLanuageUndefined = "und"; const char* kLanuageUndefined = "und";

View File

@ -70,7 +70,7 @@ const char kExpectedDefaultMediaInfoSubsegmentRange[] =
" end: 9999\n" " end: 9999\n"
"}\n"; "}\n";
const uint32_t kDefaultReferenceTimeScale = 1000u; const int32_t kDefaultReferenceTimeScale = 1000;
// Struct that gets passed for to CreateVideoStreamInfo() to create a // Struct that gets passed for to CreateVideoStreamInfo() to create a
// StreamInfo instance. Useful for generating multiple VideoStreamInfo with // StreamInfo instance. Useful for generating multiple VideoStreamInfo with
@ -79,8 +79,8 @@ struct VideoStreamInfoParameters {
VideoStreamInfoParameters(); VideoStreamInfoParameters();
~VideoStreamInfoParameters(); ~VideoStreamInfoParameters();
int track_id; int track_id;
uint32_t time_scale; int32_t time_scale;
uint64_t duration; int64_t duration;
Codec codec; Codec codec;
std::string codec_string; std::string codec_string;
std::string language; std::string language;
@ -95,8 +95,8 @@ struct VideoStreamInfoParameters {
struct OnNewSegmentParameters { struct OnNewSegmentParameters {
std::string file_name; std::string file_name;
uint64_t start_time; int64_t start_time;
uint64_t duration; int64_t duration;
uint64_t segment_file_size; uint64_t segment_file_size;
}; };

View File

@ -46,7 +46,7 @@ void VodMediaInfoDumpMuxerListener::OnEncryptionInfoReady(
void VodMediaInfoDumpMuxerListener::OnMediaStart( void VodMediaInfoDumpMuxerListener::OnMediaStart(
const MuxerOptions& muxer_options, const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) { ContainerType container_type) {
DCHECK(muxer_options.segment_template.empty()); DCHECK(muxer_options.segment_template.empty());
media_info_.reset(new MediaInfo()); media_info_.reset(new MediaInfo());
@ -68,7 +68,7 @@ void VodMediaInfoDumpMuxerListener::OnMediaStart(
void VodMediaInfoDumpMuxerListener::OnEncryptionStart() {} void VodMediaInfoDumpMuxerListener::OnEncryptionStart() {}
void VodMediaInfoDumpMuxerListener::OnSampleDurationReady( void VodMediaInfoDumpMuxerListener::OnSampleDurationReady(
uint32_t sample_duration) { int32_t sample_duration) {
// Assume one VideoInfo. // Assume one VideoInfo.
if (media_info_->has_video_info()) { if (media_info_->has_video_info()) {
media_info_->mutable_video_info()->set_frame_duration(sample_duration); media_info_->mutable_video_info()->set_frame_duration(sample_duration);

View File

@ -41,9 +41,9 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
void OnEncryptionStart() override; void OnEncryptionStart() override;
void OnMediaStart(const MuxerOptions& muxer_options, void OnMediaStart(const MuxerOptions& muxer_options,
const StreamInfo& stream_info, const StreamInfo& stream_info,
uint32_t time_scale, int32_t time_scale,
ContainerType container_type) override; ContainerType container_type) override;
void OnSampleDurationReady(uint32_t sample_duration) override; void OnSampleDurationReady(int32_t sample_duration) override;
void OnMediaEnd(const MediaRanges& media_ranges, void OnMediaEnd(const MediaRanges& media_ranges,
float duration_seconds) override; float duration_seconds) override;
void OnNewSegment(const std::string& file_name, void OnNewSegment(const std::string& file_name,

View File

@ -88,7 +88,7 @@ class VodMediaInfoDumpMuxerListenerTest : public ::testing::Test {
bool enable_encryption) { bool enable_encryption) {
MuxerOptions muxer_options; MuxerOptions muxer_options;
SetDefaultMuxerOptions(&muxer_options); SetDefaultMuxerOptions(&muxer_options);
const uint32_t kReferenceTimeScale = 1000; const int32_t kReferenceTimeScale = 1000;
if (enable_encryption) { if (enable_encryption) {
std::vector<uint8_t> bogus_default_key_id( std::vector<uint8_t> bogus_default_key_id(
kBogusDefaultKeyId, kBogusDefaultKeyId,

View File

@ -326,7 +326,7 @@ bool EsParserH26x::EmitFrame(int64_t access_unit_pos,
const int64_t kArbitrarySmallDuration = 0.001 * kMpeg2Timescale; // 1ms. const int64_t kArbitrarySmallDuration = 0.001 * kMpeg2Timescale; // 1ms.
pending_sample_->set_duration(kArbitrarySmallDuration); pending_sample_->set_duration(kArbitrarySmallDuration);
} else { } else {
uint64_t sample_duration = media_sample->dts() - pending_sample_->dts(); int64_t sample_duration = media_sample->dts() - pending_sample_->dts();
pending_sample_->set_duration(sample_duration); pending_sample_->set_duration(sample_duration);
const int kArbitraryGapScale = 10; const int kArbitraryGapScale = 10;

View File

@ -127,7 +127,7 @@ class EsParserH26x : public EsParser {
// Frame for which we do not yet have a duration. // Frame for which we do not yet have a duration.
std::shared_ptr<MediaSample> pending_sample_; std::shared_ptr<MediaSample> pending_sample_;
uint64_t pending_sample_duration_ = 0; int64_t pending_sample_duration_ = 0;
// Indicates whether waiting for first key frame. // Indicates whether waiting for first key frame.
bool waiting_for_key_frame_ = true; bool waiting_for_key_frame_ = true;

View File

@ -22,7 +22,7 @@
namespace shaka { namespace shaka {
namespace media { namespace media {
const uint32_t kMpeg2Timescale = 90000; const int32_t kMpeg2Timescale = 90000;
} // namespace media } // namespace media
} // namespace shaka } // namespace shaka

View File

@ -31,7 +31,7 @@ const double kTsTimescale = 90000.0;
} // namespace } // namespace
PesPacketGenerator::PesPacketGenerator( PesPacketGenerator::PesPacketGenerator(
uint32_t transport_stream_timestamp_offset) int32_t transport_stream_timestamp_offset)
: transport_stream_timestamp_offset_(transport_stream_timestamp_offset) {} : transport_stream_timestamp_offset_(transport_stream_timestamp_offset) {}
PesPacketGenerator::~PesPacketGenerator() {} PesPacketGenerator::~PesPacketGenerator() {}

View File

@ -31,7 +31,7 @@ class PesPacketGenerator {
/// @param transport_stream_timestamp_offset is the offset to be applied to /// @param transport_stream_timestamp_offset is the offset to be applied to
/// sample timestamps to compensate for possible negative timestamps in /// sample timestamps to compensate for possible negative timestamps in
/// the input. /// the input.
explicit PesPacketGenerator(uint32_t transport_stream_timestamp_offset); explicit PesPacketGenerator(int32_t transport_stream_timestamp_offset);
virtual ~PesPacketGenerator(); virtual ~PesPacketGenerator();
/// Initialize the object. This clears the internal state first so any /// Initialize the object. This clears the internal state first so any
@ -65,7 +65,7 @@ class PesPacketGenerator {
StreamType stream_type_; StreamType stream_type_;
const uint32_t transport_stream_timestamp_offset_ = 0; const int32_t transport_stream_timestamp_offset_ = 0;
// Calculated by 90000 / input stream's timescale. This is used to scale the // Calculated by 90000 / input stream's timescale. This is used to scale the
// timestamps. // timestamps.
double timescale_scale_ = 0.0; double timescale_scale_ = 0.0;

View File

@ -36,7 +36,7 @@ using ::testing::SetArgPointee;
namespace { namespace {
const uint32_t kZeroTransportStreamTimestampOffset = 0; const int32_t kZeroTransportStreamTimestampOffset = 0;
// Bogus data for testing. // Bogus data for testing.
const uint8_t kAnyData[] = { const uint8_t kAnyData[] = {
@ -75,8 +75,8 @@ const uint8_t kVideoExtraData[] = {
const uint8_t kAudioExtraData[] = {0x12, 0x10}; const uint8_t kAudioExtraData[] = {0x12, 0x10};
const int kTrackId = 0; const int kTrackId = 0;
const uint32_t kTimeScale = 90000; const int32_t kTimeScale = 90000;
const uint64_t kDuration = 180000; const int64_t kDuration = 180000;
const char kCodecString[] = "avc1"; const char kCodecString[] = "avc1";
const char kLanguage[] = "eng"; const char kLanguage[] = "eng";
const uint32_t kWidth = 1280; const uint32_t kWidth = 1280;
@ -198,7 +198,7 @@ TEST_F(PesPacketGeneratorTest, AddVideoSample) {
std::shared_ptr<MediaSample> sample = std::shared_ptr<MediaSample> sample =
MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame); MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame);
const uint32_t kPts = 12345; const int32_t kPts = 12345;
const uint32_t kDts = 12300; const uint32_t kDts = 12300;
sample->set_pts(kPts); sample->set_pts(kPts);
sample->set_dts(kDts); sample->set_dts(kDts);
@ -236,7 +236,7 @@ TEST_F(PesPacketGeneratorTest, AddEncryptedVideoSample) {
std::shared_ptr<MediaSample> sample = std::shared_ptr<MediaSample> sample =
MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame); MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame);
const uint32_t kPts = 12345; const int32_t kPts = 12345;
const uint32_t kDts = 12300; const uint32_t kDts = 12300;
sample->set_pts(kPts); sample->set_pts(kPts);
sample->set_dts(kDts); sample->set_dts(kDts);
@ -352,7 +352,7 @@ TEST_F(PesPacketGeneratorTest, AddAudioSampleFailedToConvert) {
// Because TS has to use 90000 as its timescale, make sure that the timestamps // Because TS has to use 90000 as its timescale, make sure that the timestamps
// are scaled. // are scaled.
TEST_F(PesPacketGeneratorTest, TimeStampScaling) { TEST_F(PesPacketGeneratorTest, TimeStampScaling) {
const uint32_t kTestTimescale = 1000; const int32_t kTestTimescale = 1000;
std::shared_ptr<VideoStreamInfo> stream_info(new VideoStreamInfo( std::shared_ptr<VideoStreamInfo> stream_info(new VideoStreamInfo(
kTrackId, kTestTimescale, kDuration, kH264Codec, kTrackId, kTestTimescale, kDuration, kH264Codec,
H26xStreamFormat::kAnnexbByteStream, kCodecString, kVideoExtraData, H26xStreamFormat::kAnnexbByteStream, kCodecString, kVideoExtraData,
@ -365,7 +365,7 @@ TEST_F(PesPacketGeneratorTest, TimeStampScaling) {
std::shared_ptr<MediaSample> sample = std::shared_ptr<MediaSample> sample =
MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame); MediaSample::CopyFrom(kAnyData, arraysize(kAnyData), kIsKeyFrame);
const uint32_t kPts = 5000; const int32_t kPts = 5000;
const uint32_t kDts = 4000; const uint32_t kDts = 4000;
sample->set_pts(kPts); sample->set_pts(kPts);
sample->set_dts(kDts); sample->set_dts(kDts);

View File

@ -11,7 +11,7 @@ namespace media {
namespace mp2t { namespace mp2t {
namespace { namespace {
const uint32_t kTsTimescale = 90000; const int32_t kTsTimescale = 90000;
} // namespace } // namespace
TsMuxer::TsMuxer(const MuxerOptions& muxer_options) : Muxer(muxer_options) {} TsMuxer::TsMuxer(const MuxerOptions& muxer_options) : Muxer(muxer_options) {}

View File

@ -163,8 +163,7 @@ Status TsSegmenter::WritePesPackets() {
return Status::OK; return Status::OK;
} }
Status TsSegmenter::FinalizeSegment(uint64_t start_timestamp, Status TsSegmenter::FinalizeSegment(int64_t start_timestamp, int64_t duration) {
uint64_t duration) {
if (!pes_packet_generator_->Flush()) { if (!pes_packet_generator_->Flush()) {
return Status(error::MUXER_FAILURE, "Failed to flush PesPacketGenerator."); return Status(error::MUXER_FAILURE, "Failed to flush PesPacketGenerator.");
} }

View File

@ -58,7 +58,7 @@ class TsSegmenter {
// TODO(kqyang): Remove the usage of segment start timestamp and duration in // TODO(kqyang): Remove the usage of segment start timestamp and duration in
// xx_segmenter, which could cause confusions on which is the source of truth // xx_segmenter, which could cause confusions on which is the source of truth
// as the segment start timestamp and duration could be tracked locally. // as the segment start timestamp and duration could be tracked locally.
Status FinalizeSegment(uint64_t start_timestamp, uint64_t duration); Status FinalizeSegment(int64_t start_timestamp, int64_t duration);
/// Only for testing. /// Only for testing.
void InjectTsWriterForTesting(std::unique_ptr<TsWriter> writer); void InjectTsWriterForTesting(std::unique_ptr<TsWriter> writer);
@ -83,7 +83,7 @@ class TsSegmenter {
Codec codec_ = kUnknownCodec; Codec codec_ = kUnknownCodec;
std::vector<uint8_t> audio_codec_config_; std::vector<uint8_t> audio_codec_config_;
const uint32_t transport_stream_timestamp_offset_ = 0; const int32_t transport_stream_timestamp_offset_ = 0;
// Scale used to scale the input stream to TS's timesccale (which is 90000). // Scale used to scale the input stream to TS's timesccale (which is 90000).
// Used for calculating the duration in seconds fo the current segment. // Used for calculating the duration in seconds fo the current segment.
double timescale_scale_ = 1.0; double timescale_scale_ = 1.0;

View File

@ -36,9 +36,9 @@ const uint8_t kExtraData[] = {
0x00, 0x00,
}; };
const int kTrackId = 0; const int kTrackId = 0;
const uint32_t kZeroTransportStreamTimestampOffset = 0; const int32_t kZeroTransportStreamTimestampOffset = 0;
const uint32_t kTimeScale = 90000; const int32_t kTimeScale = 90000;
const uint64_t kDuration = 180000; const int64_t kDuration = 180000;
const char kCodecString[] = "avc1"; const char kCodecString[] = "avc1";
const char kLanguage[] = "eng"; const char kLanguage[] = "eng";
const uint32_t kWidth = 1280; const uint32_t kWidth = 1280;
@ -181,7 +181,7 @@ TEST_F(TsSegmenterTest, AddSample) {
TEST_F(TsSegmenterTest, PassedSegmentDuration) { TEST_F(TsSegmenterTest, PassedSegmentDuration) {
// Use something significantly smaller than 90000 to check that the scaling is // Use something significantly smaller than 90000 to check that the scaling is
// done correctly in the segmenter. // done correctly in the segmenter.
const uint32_t kInputTimescale = 1001; const int32_t kInputTimescale = 1001;
std::shared_ptr<VideoStreamInfo> stream_info(new VideoStreamInfo( std::shared_ptr<VideoStreamInfo> stream_info(new VideoStreamInfo(
kTrackId, kInputTimescale, kDuration, kH264Codec, kTrackId, kInputTimescale, kDuration, kH264Codec,
H26xStreamFormat::kAnnexbByteStream, kCodecString, kExtraData, H26xStreamFormat::kAnnexbByteStream, kCodecString, kExtraData,
@ -194,7 +194,7 @@ TEST_F(TsSegmenterTest, PassedSegmentDuration) {
MockMuxerListener mock_listener; MockMuxerListener mock_listener;
TsSegmenter segmenter(options, &mock_listener); TsSegmenter segmenter(options, &mock_listener);
const uint32_t kFirstPts = 1000; const int32_t kFirstPts = 1000;
EXPECT_CALL(*mock_pes_packet_generator_, Initialize(_)) EXPECT_CALL(*mock_pes_packet_generator_, Initialize(_))
.WillOnce(Return(true)); .WillOnce(Return(true));

View File

@ -37,12 +37,12 @@ bool DecodingTimeIterator::IsValid() const {
sample_index_ < iterator_->sample_count; sample_index_ < iterator_->sample_count;
} }
uint64_t DecodingTimeIterator::Duration(uint32_t start_sample, int64_t DecodingTimeIterator::Duration(uint32_t start_sample,
uint32_t end_sample) const { uint32_t end_sample) const {
DCHECK_LE(start_sample, end_sample); DCHECK_LE(start_sample, end_sample);
uint32_t current_sample = 0; uint32_t current_sample = 0;
uint32_t prev_sample = 0; uint32_t prev_sample = 0;
uint64_t duration = 0; int64_t duration = 0;
std::vector<DecodingTime>::const_iterator it = decoding_time_table_.begin(); std::vector<DecodingTime>::const_iterator it = decoding_time_table_.begin();
for (; it != decoding_time_table_.end(); ++it) { for (; it != decoding_time_table_.end(); ++it) {
current_sample += it->sample_count; current_sample += it->sample_count;

View File

@ -40,7 +40,7 @@ class DecodingTimeIterator {
uint32_t sample_delta() const { return iterator_->sample_delta; } uint32_t sample_delta() const { return iterator_->sample_delta; }
/// @return Duration from start_sample to end_sample, both 1-based, inclusive. /// @return Duration from start_sample to end_sample, both 1-based, inclusive.
uint64_t Duration(uint32_t start_sample, uint32_t end_sample) const; int64_t Duration(uint32_t start_sample, uint32_t end_sample) const;
/// @return Total number of samples in the table. /// @return Total number of samples in the table.
uint32_t NumSamples() const; uint32_t NumSamples() const;

View File

@ -19,7 +19,7 @@ class DecodingTimeIteratorTest : public testing::Test {
public: public:
DecodingTimeIteratorTest() { DecodingTimeIteratorTest() {
// Build decoding time table from kDecodingTimes. // Build decoding time table from kDecodingTimes.
uint32_t decoding_time = 0; int32_t decoding_time = 0;
uint32_t length = sizeof(kDecodingTimes) / sizeof(DecodingTime); uint32_t length = sizeof(kDecodingTimes) / sizeof(DecodingTime);
for (uint32_t i = 0; i < length; ++i) { for (uint32_t i = 0; i < length; ++i) {
for (uint32_t j = 0; j < kDecodingTimes[i].sample_count; ++j) { for (uint32_t j = 0; j < kDecodingTimes[i].sample_count; ++j) {

View File

@ -90,8 +90,7 @@ Status Fragmenter::AddSample(const MediaSample& sample) {
if (stream_info_->stream_type() == StreamType::kStreamVideo && if (stream_info_->stream_type() == StreamType::kStreamVideo &&
sample.is_key_frame()) { sample.is_key_frame()) {
key_frame_infos_.push_back( key_frame_infos_.push_back({pts, data_->Size(), sample.data_size()});
{static_cast<uint64_t>(pts), data_->Size(), sample.data_size()});
} }
data_->AppendArray(sample.data(), sample.data_size()); data_->AppendArray(sample.data(), sample.data_size());

View File

@ -59,9 +59,9 @@ class Fragmenter {
void ClearFragmentFinalized() { fragment_finalized_ = false; } void ClearFragmentFinalized() { fragment_finalized_ = false; }
uint64_t fragment_duration() const { return fragment_duration_; } int64_t fragment_duration() const { return fragment_duration_; }
uint64_t first_sap_time() const { return first_sap_time_; } int64_t first_sap_time() const { return first_sap_time_; }
uint64_t earliest_presentation_time() const { int64_t earliest_presentation_time() const {
return earliest_presentation_time_; return earliest_presentation_time_;
} }
bool fragment_initialized() const { return fragment_initialized_; } bool fragment_initialized() const { return fragment_initialized_; }

View File

@ -15,7 +15,7 @@ namespace mp4 {
/// Tracks key frame information. /// Tracks key frame information.
struct KeyFrameInfo { struct KeyFrameInfo {
uint64_t timestamp; int64_t timestamp;
uint64_t start_byte_offset; uint64_t start_byte_offset;
uint64_t size; uint64_t size;
}; };

View File

@ -39,9 +39,9 @@ namespace media {
namespace mp4 { namespace mp4 {
namespace { namespace {
uint64_t Rescale(uint64_t time_in_old_scale, int64_t Rescale(int64_t time_in_old_scale,
uint32_t old_scale, int32_t old_scale,
uint32_t new_scale) { int32_t new_scale) {
return (static_cast<double>(time_in_old_scale) / old_scale) * new_scale; return (static_cast<double>(time_in_old_scale) / old_scale) * new_scale;
} }
@ -386,10 +386,10 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
for (std::vector<Track>::const_iterator track = moov_->tracks.begin(); for (std::vector<Track>::const_iterator track = moov_->tracks.begin();
track != moov_->tracks.end(); ++track) { track != moov_->tracks.end(); ++track) {
const uint32_t timescale = track->media.header.timescale; const int32_t timescale = track->media.header.timescale;
// Calculate duration (based on timescale). // Calculate duration (based on timescale).
uint64_t duration = 0; int64_t duration = 0;
if (track->media.header.duration > 0) { if (track->media.header.duration > 0) {
duration = track->media.header.duration; duration = track->media.header.duration;
} else if (moov_->extends.header.fragment_duration > 0) { } else if (moov_->extends.header.fragment_duration > 0) {

View File

@ -655,7 +655,7 @@ void MP4Muxer::FireOnMediaStartEvent() {
} }
DCHECK(!streams().empty()) << "Media started without a stream."; DCHECK(!streams().empty()) << "Media started without a stream.";
const uint32_t timescale = segmenter_->GetReferenceTimeScale(); const int32_t timescale = segmenter_->GetReferenceTimeScale();
muxer_listener()->OnMediaStart(options(), *streams().front(), timescale, muxer_listener()->OnMediaStart(options(), *streams().front(), timescale,
MuxerListener::kContainerMp4); MuxerListener::kContainerMp4);
} }

View File

@ -148,7 +148,7 @@ Status MultiSegmentSegmenter::WriteSegment() {
", possibly file permission issue or running out of disk space."); ", possibly file permission issue or running out of disk space.");
} }
uint64_t segment_duration = 0; int64_t segment_duration = 0;
// ISO/IEC 23009-1:2012: the value shall be identical to sum of the the // ISO/IEC 23009-1:2012: the value shall be identical to sum of the the
// values of all Subsegment_duration fields in the first sidx box. // values of all Subsegment_duration fields in the first sidx box.
for (size_t i = 0; i < sidx()->references.size(); ++i) for (size_t i = 0; i < sidx()->references.size(); ++i)

View File

@ -28,9 +28,9 @@ namespace mp4 {
namespace { namespace {
uint64_t Rescale(uint64_t time_in_old_scale, int64_t Rescale(int64_t time_in_old_scale,
uint32_t old_scale, int32_t old_scale,
uint32_t new_scale) { int32_t new_scale) {
return static_cast<double>(time_in_old_scale) / old_scale * new_scale; return static_cast<double>(time_in_old_scale) / old_scale * new_scale;
} }
@ -111,10 +111,11 @@ Status Segmenter::Finalize() {
// file for VOD and static live case only. // file for VOD and static live case only.
moov_->extends.header.fragment_duration = 0; moov_->extends.header.fragment_duration = 0;
for (size_t i = 0; i < stream_durations_.size(); ++i) { for (size_t i = 0; i < stream_durations_.size(); ++i) {
uint64_t duration = int64_t duration =
Rescale(stream_durations_[i], moov_->tracks[i].media.header.timescale, Rescale(stream_durations_[i], moov_->tracks[i].media.header.timescale,
moov_->header.timescale); moov_->header.timescale);
if (duration > moov_->extends.header.fragment_duration) if (duration >
static_cast<int64_t>(moov_->extends.header.fragment_duration))
moov_->extends.header.fragment_duration = duration; moov_->extends.header.fragment_duration = duration;
} }
return DoFinalize(); return DoFinalize();
@ -234,12 +235,12 @@ Status Segmenter::FinalizeSegment(size_t stream_id,
return Status::OK; return Status::OK;
} }
uint32_t Segmenter::GetReferenceTimeScale() const { int32_t Segmenter::GetReferenceTimeScale() const {
return moov_->header.timescale; return moov_->header.timescale;
} }
double Segmenter::GetDuration() const { double Segmenter::GetDuration() const {
uint64_t duration = moov_->extends.header.fragment_duration; int64_t duration = moov_->extends.header.fragment_duration;
if (duration == 0) { if (duration == 0) {
// Handling the case where this is not properly initialized. // Handling the case where this is not properly initialized.
return 0.0; return 0.0;

View File

@ -91,14 +91,14 @@ class Segmenter {
// Otherwise, a vector of ranges for the media segments are returned. // Otherwise, a vector of ranges for the media segments are returned.
virtual std::vector<Range> GetSegmentRanges() = 0; virtual std::vector<Range> GetSegmentRanges() = 0;
uint32_t GetReferenceTimeScale() const; int32_t GetReferenceTimeScale() const;
/// @return The total length, in seconds, of segmented media files. /// @return The total length, in seconds, of segmented media files.
double GetDuration() const; double GetDuration() const;
/// @return The sample duration in the timescale of the media. /// @return The sample duration in the timescale of the media.
/// Returns 0 if no samples are added yet. /// Returns 0 if no samples are added yet.
uint32_t sample_duration() const { return sample_duration_; } int32_t sample_duration() const { return sample_duration_; }
protected: protected:
/// Update segmentation progress using ProgressListener. /// Update segmentation progress using ProgressListener.
@ -144,7 +144,7 @@ class Segmenter {
ProgressListener* progress_listener_ = nullptr; ProgressListener* progress_listener_ = nullptr;
uint64_t progress_target_ = 0u; uint64_t progress_target_ = 0u;
uint64_t accumulated_progress_ = 0u; uint64_t accumulated_progress_ = 0u;
uint32_t sample_duration_ = 0u; int32_t sample_duration_ = 0;
std::vector<uint64_t> stream_durations_; std::vector<uint64_t> stream_durations_;
std::vector<KeyFrameInfo> key_frame_infos_; std::vector<KeyFrameInfo> key_frame_infos_;

View File

@ -174,7 +174,7 @@ Status SingleSegmentSegmenter::DoFinalizeSegment() {
// reference, which contains all the fragments in sidx(). // reference, which contains all the fragments in sidx().
std::vector<SegmentReference>& refs = sidx()->references; std::vector<SegmentReference>& refs = sidx()->references;
SegmentReference& vod_ref = refs[0]; SegmentReference& vod_ref = refs[0];
uint64_t first_sap_time = int64_t first_sap_time =
refs[0].sap_delta_time + refs[0].earliest_presentation_time; refs[0].sap_delta_time + refs[0].earliest_presentation_time;
for (uint32_t i = 1; i < refs.size(); ++i) { for (uint32_t i = 1; i < refs.size(); ++i) {
vod_ref.referenced_size += refs[i].referenced_size; vod_ref.referenced_size += refs[i].referenced_size;

View File

@ -26,8 +26,8 @@ namespace {
const int64_t kInvalidOffset = std::numeric_limits<int64_t>::max(); const int64_t kInvalidOffset = std::numeric_limits<int64_t>::max();
int64_t Rescale(int64_t time_in_old_scale, int64_t Rescale(int64_t time_in_old_scale,
uint32_t old_scale, int32_t old_scale,
uint32_t new_scale) { int32_t new_scale) {
return (static_cast<double>(time_in_old_scale) / old_scale) * new_scale; return (static_cast<double>(time_in_old_scale) / old_scale) * new_scale;
} }

View File

@ -17,7 +17,7 @@
namespace shaka { namespace shaka {
namespace media { namespace media {
namespace { namespace {
std::string TimestampToString(uint64_t timestamp) { std::string TimestampToString(int64_t timestamp) {
// https://tools.ietf.org/html/rfc8216 The ID3 payload MUST be a 33-bit MPEG-2 // https://tools.ietf.org/html/rfc8216 The ID3 payload MUST be a 33-bit MPEG-2
// Program Elementary Stream timestamp expressed as a big-endian eight-octet // Program Elementary Stream timestamp expressed as a big-endian eight-octet
// number, with the upper 31 bits set to zero. // number, with the upper 31 bits set to zero.
@ -30,7 +30,7 @@ std::string TimestampToString(uint64_t timestamp) {
} // namespace } // namespace
PackedAudioSegmenter::PackedAudioSegmenter( PackedAudioSegmenter::PackedAudioSegmenter(
uint32_t transport_stream_timestamp_offset) int32_t transport_stream_timestamp_offset)
: transport_stream_timestamp_offset_(transport_stream_timestamp_offset) {} : transport_stream_timestamp_offset_(transport_stream_timestamp_offset) {}
PackedAudioSegmenter::~PackedAudioSegmenter() = default; PackedAudioSegmenter::~PackedAudioSegmenter() = default;

View File

@ -42,7 +42,7 @@ class PackedAudioSegmenter {
/// @param transport_stream_timestamp_offset is the offset to be applied to /// @param transport_stream_timestamp_offset is the offset to be applied to
/// sample timestamps to compensate for possible negative timestamps in /// sample timestamps to compensate for possible negative timestamps in
/// the input. /// the input.
explicit PackedAudioSegmenter(uint32_t transport_stream_timestamp_offset); explicit PackedAudioSegmenter(int32_t transport_stream_timestamp_offset);
virtual ~PackedAudioSegmenter(); virtual ~PackedAudioSegmenter();
/// Initialize the object. /// Initialize the object.
@ -81,7 +81,7 @@ class PackedAudioSegmenter {
Status EncryptionAudioSetup(const MediaSample& sample); Status EncryptionAudioSetup(const MediaSample& sample);
Status StartNewSegment(const MediaSample& first_sample); Status StartNewSegment(const MediaSample& first_sample);
const uint32_t transport_stream_timestamp_offset_ = 0; const int32_t transport_stream_timestamp_offset_ = 0;
// Codec for the stream. // Codec for the stream.
Codec codec_ = kUnknownCodec; Codec codec_ = kUnknownCodec;
std::vector<uint8_t> audio_codec_config_; std::vector<uint8_t> audio_codec_config_;

View File

@ -28,13 +28,13 @@ namespace shaka {
namespace media { namespace media {
namespace { namespace {
constexpr uint32_t kZeroTransportStreamTimestampOffset = 0; constexpr int32_t kZeroTransportStreamTimestampOffset = 0;
constexpr uint32_t kTimescale = 5625; constexpr int32_t kTimescale = 5625;
constexpr double kExpectedTimescaleScale = kPackedAudioTimescale / kTimescale; constexpr double kExpectedTimescaleScale = kPackedAudioTimescale / kTimescale;
static_assert(kExpectedTimescaleScale == 16.0, ""); static_assert(kExpectedTimescaleScale == 16.0, "");
const int kTrackId = 0; const int kTrackId = 0;
const uint64_t kDuration = 180000; const int64_t kDuration = 180000;
const char kCodecString[] = "codec-string"; const char kCodecString[] = "codec-string";
const char kLanguage[] = "eng"; const char kLanguage[] = "eng";
const bool kIsEncrypted = true; const bool kIsEncrypted = true;

View File

@ -73,7 +73,7 @@ Status PackedAudioWriter::FinalizeSegment(size_t stream_id,
RETURN_IF_ERROR(segmenter_->FinalizeSegment()); RETURN_IF_ERROR(segmenter_->FinalizeSegment());
const uint64_t segment_timestamp = const int64_t segment_timestamp =
segment_info.start_timestamp * segmenter_->TimescaleScale(); segment_info.start_timestamp * segmenter_->TimescaleScale();
std::string segment_path = std::string segment_path =
options().segment_template.empty() options().segment_template.empty()

View File

@ -43,14 +43,14 @@ class PackedAudioWriter : public Muxer {
Status CloseFile(std::unique_ptr<File, FileCloser> file); Status CloseFile(std::unique_ptr<File, FileCloser> file);
const uint32_t transport_stream_timestamp_offset_ = 0; const int32_t transport_stream_timestamp_offset_ = 0;
std::unique_ptr<PackedAudioSegmenter> segmenter_; std::unique_ptr<PackedAudioSegmenter> segmenter_;
// Used in single segment mode. // Used in single segment mode.
std::unique_ptr<File, FileCloser> output_file_; std::unique_ptr<File, FileCloser> output_file_;
// Keeps track of segment ranges in single segment mode. // Keeps track of segment ranges in single segment mode.
MuxerListener::MediaRanges media_ranges_; MuxerListener::MediaRanges media_ranges_;
uint64_t total_duration_ = 0; int64_t total_duration_ = 0;
// Used in multi-segment mode for segment template. // Used in multi-segment mode for segment template.
uint64_t segment_number_ = 0; uint64_t segment_number_ = 0;

View File

@ -35,8 +35,8 @@ const size_t kOutputs = 0;
const size_t kInput = 0; const size_t kInput = 0;
const size_t kStreamIndex = 0; const size_t kStreamIndex = 0;
const uint32_t kZeroTransportStreamTimestampOffset = 0; const int32_t kZeroTransportStreamTimestampOffset = 0;
const uint32_t kTimescale = 9000; const int32_t kTimescale = 9000;
// For single-segment mode. // For single-segment mode.
const char kOutputFile[] = "memory://test.aac"; const char kOutputFile[] = "memory://test.aac";

Some files were not shown because too many files have changed in this diff Show More