Skip to content

Commit

Permalink
RtmpPublisherも独自のやつを利用するように変更してみた。
Browse files Browse the repository at this point in the history
これで下準備はほぼおわりか?
  • Loading branch information
taktod committed Nov 23, 2012
1 parent f4d7aa0 commit c6c11cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/com/ttProject/flazr/client/ClientHandlerEx.java
Expand Up @@ -33,11 +33,12 @@
import com.flazr.rtmp.message.WindowAckSize;
import com.flazr.util.ChannelUtils;
import com.flazr.util.Utils;
import com.ttProject.flazr.rtmp.RtmpPublisherEx;

@ChannelPipelineCoverage("one")
public class ClientHandlerEx extends SimpleChannelUpstreamHandler {

private static final Logger logger = LoggerFactory.getLogger(ClientHandler.class);
private static final Logger logger = LoggerFactory.getLogger(ClientHandlerEx.class);

private int transactionId = 1;
private Map<Integer, String> transactionToCommandMap;
Expand Down Expand Up @@ -178,14 +179,14 @@ public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent
if(options.getPublishType() != null) { // TODO append, record
RtmpReader reader;
if(options.getFileToPublish() != null) {
reader = RtmpPublisher.getReader(options.getFileToPublish());
reader = RtmpPublisherEx.getReader(options.getFileToPublish());
} else {
reader = options.getReaderToPublish();
}
if(options.getLoop() > 1) {
reader = new LoopedReader(reader, options.getLoop());
}
publisher = new RtmpPublisher(reader, streamId, options.getBuffer(), false, false) {
publisher = new RtmpPublisherEx(reader, streamId, options.getBuffer(), false, false) {
@Override protected RtmpMessage[] getStopMessages(long timePosition) {
return new RtmpMessage[]{Command.unpublish(streamId)};
}
Expand Down
16 changes: 16 additions & 0 deletions src/com/ttProject/flazr/rtmp/RtmpPublisherEx.java
@@ -0,0 +1,16 @@
package com.ttProject.flazr.rtmp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.flazr.rtmp.RtmpPublisher;
import com.flazr.rtmp.RtmpReader;

public abstract class RtmpPublisherEx extends RtmpPublisher {
private static final Logger logger = LoggerFactory.getLogger(RtmpPublisherEx.class);
public RtmpPublisherEx(final RtmpReader reader, final int streamId, final int bufferDuration,
boolean useSharedTimer, boolean aggregateModeEnabled) {
super(reader, streamId, bufferDuration, useSharedTimer, aggregateModeEnabled);
logger.info("RtmpPublisherExがよばれたよん。");
}
}

0 comments on commit c6c11cc

Please sign in to comment.